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, 11 Aug 2009 11:00:15 +0200
From:	Jiri Slaby <jirislaby@...il.com>
To:	roel kluin <roel.kluin@...il.com>
CC:	Andrew Morton <akpm@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] applicom: Prevent unsigned wrap in ac_interrupt()

On 08/11/2009 10:54 AM, roel kluin wrote:
>>> unsigned i wraps if this occurs in the first iteration.
>>
>> Could you elaborate? I don't quite understand the point.
> 
> `i' is unsigned. The last test in the loop is:
> 
> if(readb(apbs[i].RamIO + RAM_IT_TO_PC)) {
>         /* There's another int waiting on this card */
>         spin_unlock(&apbs[i].mutex);
>         i--;
> } else {
>         spin_unlock(&apbs[i].mutex);
> }
> 
> In the first iteration `i' is 0, so if this condition evaluates to true
> then `i' becomes 0xffffffff (since it's unsigned), the for loop test
> fails and the i++ never occurs.

Hmm, no. This is not how three `for' expressions are evaluated. The CFG
of "for (a; b; c) d;" is "a->(b->d->c)*". Read 6.8.5.3 of ANSI C99.

I.e. 0xff increments back to 0.

Am I still missing something?
--
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