mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* hlist_add_after broken?
@ 2004-04-17 22:30 Pedro Emanuel M. D. Pinto
  0 siblings, 0 replies; only message in thread
From: Pedro Emanuel M. D. Pinto @ 2004-04-17 22:30 UTC (permalink / raw)
  To: linux kernel

There is an inline function (hlist_add_after) in include/linux/list.h which I 
believe is broken. The algorithm used doesn't make sence to me so if it 
actually ok I would appreciate if someone could explain it to me. Below is a 
patch I made against version 2.6.1 of what I believe is a working function.

regards,

Pedro Pinto


--- include/linux/list.h.orig	2004-04-17 23:13:42.901457376 +0100
+++ include/linux/list.h	2004-04-17 23:17:28.943093824 +0100
@@ -525,9 +525,12 @@
 static __inline__ void hlist_add_after(struct hlist_node *n,
 				       struct hlist_node *next)
 {
-	next->next	= n->next;
-	*(next->pprev)	= n;
-	n->next		= next;
+	next->next = n->next;
+	n->next = next;
+	next->pprev = &n->next;
+
+	if(next->next)
+		next->next->pprev  = &next->next;
 }

 #define hlist_entry(ptr, type, member) container_of(ptr,type,member)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-04-17 22:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-17 22:30 hlist_add_after broken? Pedro Emanuel M. D. Pinto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®