lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 9 Apr 2013 13:36:47 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Nikola Pajkovsky <npajkovs@...hat.com>
Cc:	Stanislav Kinsbursky <skinsbursky@...allels.com>,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Peter Hurley <peter@...leysoftware.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ipc: use list_for_each_entry for list traversing

On Tue, 09 Apr 2013 11:39:07 +0200 Nikola Pajkovsky <npajkovs@...hat.com> wrote:

> Andrew Morton <akpm@...ux-foundation.org> writes:
> 
> > urgh, that code is sick.  What's it doing poking around in the
> > list_head internals?
> 
> No idea, it there from beginning of first kernel importation into
> git. Where is history before git?

The old bitkeeper repo is at
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/old-2.6-bkcvs.git
and goes back to the 2.4->2.5 split iirc.  But this code predates that
- my trusty CVS tree goes back to linux-2.4.2-pre2 (November 2000) and
the list.next hackery is in there.

> >> @@ -253,14 +248,9 @@ static void ss_wakeup(struct list_head *h, int kill)
> >>  
> >>  static void expunge_all(struct msg_queue *msq, int res)
> >>  {
> >> -	struct list_head *tmp;
> >> -
> >> -	tmp = msq->q_receivers.next;
> >> -	while (tmp != &msq->q_receivers) {
> >> -		struct msg_receiver *msr;
> >> +	struct msg_receiver *msr, *t;
> >>  
> >> -		msr = list_entry(tmp, struct msg_receiver, r_list);
> >> -		tmp = tmp->next;
> >> +	list_for_each_entry_safe(msr, t, &msq->q_receivers, r_list) {
> >>  		msr->r_msg = NULL;
> >>  		wake_up_process(msr->r_tsk);
> >>  		smp_mb();
> >
> > I think list_for_each_entry() would suffice here.
> 
> I don't know, I found wake_up_sem_queue_do in sem.c and it looks almost same
> except preempt stuff. I'll be dancing around ipc/

wake_up_sem_queue_do() is wrong ;)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ