mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Dave Jones <davej@redhat.com>
Cc: alsa-devel@lists.sourceforge.net,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: list corruption on removal of snd_seq_dummy
Date: Tue, 27 Jun 2006 11:28:56 +0200	[thread overview]
Message-ID: <s5hejxb7xrb.wl%tiwai@suse.de> (raw)
In-Reply-To: <20060627032738.GA26575@redhat.com>

At Mon, 26 Jun 2006 23:27:38 -0400,
Dave Jones wrote:
> 
> On Fri, Jun 23, 2006 at 12:47:46PM +0200, Takashi Iwai wrote:
>  
>  > > The code in question is doing..
>  > > 
>  > >         __list_add(&deleted_list,
>  > >                client->ports_list_head.prev,
>  > >                client->ports_list_head.next);
>  > > 
>  > > which looks fishy, as those two elements aren't going to be consecutive,
>  > > as __list_add expects.
>  > 
>  > I think the code behaves correctly but probably misusing __list_add().
>  > It movies the whole entries from an existing list_head A
>  > (clients->ports_list_head) to a new list_head B (deleted_list).
>  > The above is exapnded:
>  > 
>  > 	A->next->prev = B;
>  > 	B->next = A->next;
>  > 	B->prev = A->prev;
>  > 	A->prev->next = B;
>  > 
>  > Any better way to achieve it using standard macros?
> 
> Why can't you just list_move() the elements ?

No, list_move() can't move the whole elements without loop.

A solution is

	list_add(B, A);
	list_del_init(A);

(although this introduces a bit more code :)


Takashi

  reply	other threads:[~2006-06-27  9:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-23  3:15 Dave Jones
2006-06-23 10:47 ` Takashi Iwai
2006-06-27  3:27   ` Dave Jones
2006-06-27  9:28     ` Takashi Iwai [this message]
2006-06-27 12:05 Chuck Ebbert
2006-06-27 12:38 ` Takashi Iwai
2006-06-27 16:58   ` Dave Jones
2006-06-27 17:07     ` Takashi Iwai

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=s5hejxb7xrb.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=davej@redhat.com \
    --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®