mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Pedro Emanuel M. D. Pinto" <pepinto@student.dei.uc.pt>
To: linux kernel <linux-kernel@vger.kernel.org>
Subject: hlist_add_after broken?
Date: Sat, 17 Apr 2004 23:30:34 +0100	[thread overview]
Message-ID: <200404172330.34993.pepinto@student.dei.uc.pt> (raw)

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)


                 reply	other threads:[~2004-04-17 22:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200404172330.34993.pepinto@student.dei.uc.pt \
    --to=pepinto@student.dei.uc.pt \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®