lkml.org 
[lkml]   [2002]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: Bug in kernel code?
On 27 Aug 2002 at 17:23, David S. Miller wrote:

> From: "Stephen C. Biggs" <s.biggs@softier.com>
> Date: Tue, 27 Aug 2002 17:24:19 -0700
>
> ........... Notice the --order >=0 in the do while test... since order is declared as an unsigned
> long, this test is a pointless comparison and never fails, causing an infinite loop if the
> hashtable is empty.
>
> My fix to this is to change the test to have
> while (dentry_hashtable == NULL && order-- != 0);
>
> Could someone check me on this?
>
> Your analysis is right but the fix is wrong, we do want to
> try order == 0 on very small memory systems, and you should
> not decrement the order at the beginning of the loop. We
> want to use the "order" calculated.
>
> Just make 'order' signed long to fix this bug.
>

NO! That won't work either. This is a "do while" loop so the first test is always done and if
order is 0, the check will be done AFTER the decrement, so this works. Changing it to a signed
long loses you a bit.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:28    [from the cache]
©2003-2011 Jasper Spaans