[PATCH] Infinite loop/always true check possible with unsigned counter.

Andreas Schwab schwab at suse.de
Tue Jul 10 19:46:28 EST 2007


Paul Mackerras <paulus at samba.org> writes:

> Manish Ahuja writes:
>
>> Repost to fix my email id.
>> 
>> Fix to correct a possible infinite loop or an always true check when the 
>> unsigned long counter "i" is used in
>> lmb_add_region() in the following for loop:
>> 
>> for (i = rgn->cnt-1; i >= 0; i--)
>
> Unfortunately this won't fix the bug.  Since rgn->cnt is unsigned
> long, the comparison will be done as an unsigned comparison even if i
> is signed.

??? There is no rgn->cnt involved in the comparison.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab at suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



More information about the Linuxppc-dev mailing list