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] [thread-next>] [day] [month] [year] [list]
Message-Id: <200607181629.27933.mb@bu3sch.de>
Date:	Tue, 18 Jul 2006 16:29:27 +0200
From:	Michael Buesch <mb@...sch.de>
To:	Valdis.Kletnieks@...edu
Cc:	linux-kernel@...r.kernel.org, keir@...source.com,
	Tony Lindgren <tony@...mide.com>, zach@...are.com,
	Ingo Molnar <mingo@...e.hu>,
	Thomas Gleixner <tglx@...utronix.de>,
	Andreas Mohr <andi@...x01.fht-esslingen.de>
Subject: Re: kernel/timer.c: next_timer_interrupt() strange/buggy(?) code (2.6.18-rc1-mm2)

On Monday 17 July 2006 21:57, Valdis.Kletnieks@...edu wrote:
> On Mon, 17 Jul 2006 20:53:30 +0200, Andreas Mohr said:
> > Hi all,
> > 
> 
> >         for (i = 0; i < 4; i++) {
> >                 j = INDEX(i);
> >                 do {
> 
> >                         if (j < (INDEX(i)) && i < 3)
> >                                 list = varray[i + 1]->vec + (INDEX(i + 1));
> >                         goto found;
> >                 } while (j != (INDEX(i)));
> >         }
> > found:
> 
> > Excuse me, but why do we have a while loop here if the last instruction in
> > the while loop is a straight "goto found"?
> 
> Consider if we take the 'goto found' when i==1.  We leave not only the do/while
> but also the for loop.  A 'continue' instead would leave the do/while and then
> drive the i==2 and subsequent 'for' iterations....

No, it would not. A 'continue' instead of the 'goto found' would
compile to nothing.
Try the following example with and without the 'continue'.

#include <stdio.h>
int main(void)
{
        int i, j;
        for (i = 0; i < 2; i++) {
                j = 0;
                do {
                        printf("i==%d, j==%d\n", i, j);
                        j++;
                        /* goto found; */
                        continue;
                } while (j < 2);
        }
}


Continue is equal to:

LOOP {
	/* foo */
	goto continue; /* == continue */
	/* foo */
continue:
} LOOP

-- 
Greetings Michael.
-
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