linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Bug in kernel code?
  2002-08-28  0:32   ` Bug in kernel code? Stephen C. Biggs
@ 2002-08-28  0:29     ` David S. Miller
  2002-08-28  0:40       ` Stephen C. Biggs
  0 siblings, 1 reply; 21+ messages in thread
From: David S. Miller @ 2002-08-28  0:29 UTC (permalink / raw)
  To: s.biggs; +Cc: linux-kernel

   From: "Stephen C. Biggs" <s.biggs@softier.com>
   Date: Tue, 27 Aug 2002 17:32:58 -0700
   
   This is a "do while" loop so the first test is always done
   
No, a "do while" loop always executes the first iteration.
What version of the C language do you think we are using?

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Bug in kernel code?
       [not found] ` <20020827.172304.22017977.davem@redhat.com>
@ 2002-08-28  0:32   ` Stephen C. Biggs
  2002-08-28  0:29     ` David S. Miller
  2002-08-28  0:54   ` Stephen C. Biggs
  1 sibling, 1 reply; 21+ messages in thread
From: Stephen C. Biggs @ 2002-08-28  0:32 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-kernel

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.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Bug in kernel code?
  2002-08-28  0:29     ` David S. Miller
@ 2002-08-28  0:40       ` Stephen C. Biggs
  2002-08-28  0:42         ` David S. Miller
  0 siblings, 1 reply; 21+ messages in thread
From: Stephen C. Biggs @ 2002-08-28  0:40 UTC (permalink / raw)
  To: David S. Miller, linux-kernel



On 27 Aug 2002 at 17:29, David S. Miller wrote:

>    From: "Stephen C. Biggs" <s.biggs@softier.com>
>    Date: Tue, 27 Aug 2002 17:32:58 -0700
>    
>    This is a "do while" loop so the first test is always done
>    
> No, a "do while" loop always executes the first iteration.
> What version of the C language do you think we are using?
> 

You're misunderstanding me, I meant that the  first test is done AFTER the first iteration is 
executed, so my fix is correct since, even if order is 0 because at least one iteration of the loop 
is done, and the post decrement makes sure that the test succeeds if order was 0 going into the 
loop.

Changing order to a signed long loses half of the cache entries due to the number being divided by 
2.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Bug in kernel code?
  2002-08-28  0:40       ` Stephen C. Biggs
@ 2002-08-28  0:42         ` David S. Miller
  2002-08-28  1:09           ` Stephen C. Biggs
  0 siblings, 1 reply; 21+ messages in thread
From: David S. Miller @ 2002-08-28  0:42 UTC (permalink / raw)
  To: s.biggs; +Cc: linux-kernel

   From: "Stephen C. Biggs" <s.biggs@softier.com>
   Date: Tue, 27 Aug 2002 17:40:41 -0700
   
   You're misunderstanding me, I meant that the  first test is done
   AFTER the first iteration is   executed, so my fix is correct
   since, even if order is 0 because at least one iteration of the
   loop  is done, and the post decrement makes sure that the test
   succeeds if order was 0 going into the loop.

Order is always >= 0 when we enter the loop.

If we actually get the table allocated then the decrement of 'order'
is not executed if we allocate the table successfully.

I don't understand what the problem is with my fix.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Bug in kernel code?
       [not found] ` <20020827.172304.22017977.davem@redhat.com>
  2002-08-28  0:32   ` Bug in kernel code? Stephen C. Biggs
@ 2002-08-28  0:54   ` Stephen C. Biggs
  1 sibling, 0 replies; 21+ messages in thread
From: Stephen C. Biggs @ 2002-08-28  0:54 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-kernel



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Bug in kernel code?
  2002-08-28  0:42         ` David S. Miller
@ 2002-08-28  1:09           ` Stephen C. Biggs
  2002-08-28  1:09             ` David S. Miller
  0 siblings, 1 reply; 21+ messages in thread
From: Stephen C. Biggs @ 2002-08-28  1:09 UTC (permalink / raw)
  To: David S. Miller, linux-kernel

On 27 Aug 2002 at 17:42, David S. Miller wrote:

>    From: "Stephen C. Biggs" <s.biggs@softier.com>
>    Date: Tue, 27 Aug 2002 17:40:41 -0700
>    
>    You're misunderstanding me, I meant that the  first test is done
>    AFTER the first iteration is   executed, so my fix is correct
>    since, even if order is 0 because at least one iteration of the
>    loop  is done, and the post decrement makes sure that the test
>    succeeds if order was 0 going into the loop.
> 
> Order is always >= 0 when we enter the loop.
> 
> If we actually get the table allocated then the decrement of 'order'
> is not executed if we allocate the table successfully.
> 
> I don't understand what the problem is with my fix.
> 
[Trying again - my mail client is messing up/sending empty posts]

As I look at it, it can only be 0 <= order < 32, so your fix works, as mine does.  Yours is simpler 
and doesn't involve changing code, just declarations.

There need to be some sanity checks in this code: what if mempages is passed as some insanely huge 
number, e.g.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Bug in kernel code?
  2002-08-28  1:09           ` Stephen C. Biggs
@ 2002-08-28  1:09             ` David S. Miller
  2002-08-28  1:24               ` Stephen C. Biggs
  0 siblings, 1 reply; 21+ messages in thread
From: David S. Miller @ 2002-08-28  1:09 UTC (permalink / raw)
  To: s.biggs; +Cc: linux-kernel

   From: "Stephen C. Biggs" <s.biggs@softier.com>
   Date: Tue, 27 Aug 2002 18:09:46 -0700
   
   There need to be some sanity checks in this code: what if mempages is passed as some insanely huge 
   number, e.g.

And then your mail ends.... let us know when you've fixed
your email client, this isn't rocket science :-)

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Bug in kernel code?
  2002-08-28  1:24               ` Stephen C. Biggs
@ 2002-08-28  1:23                 ` David S. Miller
  2002-08-28  2:42                   ` Stephen C. Biggs
  2002-08-28  2:49                   ` Re[2]: " Stephen C. Biggs
  0 siblings, 2 replies; 21+ messages in thread
From: David S. Miller @ 2002-08-28  1:23 UTC (permalink / raw)
  To: s.biggs; +Cc: linux-kernel

   From: "Stephen C. Biggs" <s.biggs@softier.com>
   Date: Tue, 27 Aug 2002 18:24:13 -0700

   On 27 Aug 2002 at 18:09, David S. Miller wrote:
   
   > And then your mail ends.... let us know when you've fixed
   > your email client, this isn't rocket science :-)
   > 
   
   What are you talking about "And then your mail ends..."  That's all I wanted to say...
   
No, I thought you were going to give an example of a huge number.
:-)


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Bug in kernel code?
  2002-08-28  1:09             ` David S. Miller
@ 2002-08-28  1:24               ` Stephen C. Biggs
  2002-08-28  1:23                 ` David S. Miller
  0 siblings, 1 reply; 21+ messages in thread
From: Stephen C. Biggs @ 2002-08-28  1:24 UTC (permalink / raw)
  To: David S. Miller, linux-kernel

On 27 Aug 2002 at 18:09, David S. Miller wrote:

>    From: "Stephen C. Biggs" <s.biggs@softier.com>
>    Date: Tue, 27 Aug 2002 18:09:46 -0700
>    
>    There need to be some sanity checks in this code: what if mempages is passed as some insanely huge 
>    number, e.g.
> 
> And then your mail ends.... let us know when you've fixed
> your email client, this isn't rocket science :-)
> 

What are you talking about "And then your mail ends..."  That's all I wanted to say...

Oh, you want me to post a complete patch.... I get it.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Bug in kernel code?
  2002-08-28  1:23                 ` David S. Miller
@ 2002-08-28  2:42                   ` Stephen C. Biggs
  2002-08-28  3:39                     ` David S. Miller
  2002-08-28  2:49                   ` Re[2]: " Stephen C. Biggs
  1 sibling, 1 reply; 21+ messages in thread
From: Stephen C. Biggs @ 2002-08-28  2:42 UTC (permalink / raw)
  To: David S. Miller, linux-kernel

On 27 Aug 2002 at 18:23, David S. Miller wrote:

>    From: "Stephen C. Biggs" <s.biggs@softier.com>
>    Date: Tue, 27 Aug 2002 18:24:13 -0700
> 
>    On 27 Aug 2002 at 18:09, David S. Miller wrote:
>    
>    > And then your mail ends.... let us know when you've fixed
>    > your email client, this isn't rocket science :-)
>    > 
>    
>    What are you talking about "And then your mail ends..."  That's all I wanted to say...
>    
> No, I thought you were going to give an example of a huge number.
> :-)
> 

How about (unsigned long)(~0)?

This code never finishes:

#include <stdio.h>

#define PAGE_SHIFT 12

struct list_head {
	struct list_head *next, *prev;
};

int main(void)
{
	unsigned long order;
	unsigned long mempages = ~0;

#if PAGE_SHIFT < 13
	mempages >>= (13 - PAGE_SHIFT);
#endif
	mempages *= sizeof(struct list_head);

	for (order = 0; ((1UL << order) << PAGE_SHIFT) < mempages; order++)
		;
	printf("%d\n",order);
	return 0;
}


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re[2]: Bug in kernel code?
  2002-08-28  1:23                 ` David S. Miller
  2002-08-28  2:42                   ` Stephen C. Biggs
@ 2002-08-28  2:49                   ` Stephen C. Biggs
  1 sibling, 0 replies; 21+ messages in thread
From: Stephen C. Biggs @ 2002-08-28  2:49 UTC (permalink / raw)
  To: David S. Miller, linux-kernel

On 27 Aug 2002 at 18:23, David S. Miller wrote:

>    From: "Stephen C. Biggs" <s.biggs@softier.com>
>    Date: Tue, 27 Aug 2002 18:24:13 -0700
> 
>    On 27 Aug 2002 at 18:09, David S. Miller wrote:
>    
>    > And then your mail ends.... let us know when you've fixed
>    > your email client, this isn't rocket science :-)
>    > 
>    
>    What are you talking about "And then your mail ends..."  That's all I wanted to say...
>    
> No, I thought you were going to give an example of a huge number.
> :-)
> 
> -
> 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/
> 

Argh.  I meant to post THIS code:

#include <stdio.h>

#define PAGE_SHIFT 12

struct list_head {
	struct list_head *next, *prev;
};

int main(void)
{
	unsigned long order;
	unsigned long mempages = ~0;

#if PAGE_SHIFT < 13
	mempages >>= (13 - PAGE_SHIFT);
#endif
	mempages *= sizeof(struct list_head);

	printf("mempages: %lu\n", mempages);

	for (order = 0; ((1UL << order) << PAGE_SHIFT) < mempages; order++)
		;
	printf("%lu\n",order);
	return 0;
}


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Bug in kernel code?
  2002-08-28  2:42                   ` Stephen C. Biggs
@ 2002-08-28  3:39                     ` David S. Miller
  2002-08-28  3:57                       ` Luca Barbieri
  2002-08-28  4:29                       ` Stephen Biggs
  0 siblings, 2 replies; 21+ messages in thread
From: David S. Miller @ 2002-08-28  3:39 UTC (permalink / raw)
  To: s.biggs; +Cc: linux-kernel

   From: "Stephen C. Biggs" <s.biggs@softier.com>
   Date: Tue, 27 Aug 2002 19:42:36 -0700

   How about (unsigned long)(~0)?
   
Realistically possible with any known configuration?

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Bug in kernel code?
  2002-08-28  3:39                     ` David S. Miller
@ 2002-08-28  3:57                       ` Luca Barbieri
  2002-08-28  3:58                         ` David S. Miller
  2002-08-28  4:29                       ` Stephen Biggs
  1 sibling, 1 reply; 21+ messages in thread
From: Luca Barbieri @ 2002-08-28  3:57 UTC (permalink / raw)
  To: David S. Miller; +Cc: s.biggs, Linux-Kernel ML

[-- Attachment #1: Type: text/plain, Size: 360 bytes --]

On Wed, 2002-08-28 at 05:39, David S. Miller wrote:
>    From: "Stephen C. Biggs" <s.biggs@softier.com>
>    Date: Tue, 27 Aug 2002 19:42:36 -0700
> 
>    How about (unsigned long)(~0)?
>    
> Realistically possible with any known configuration?
How about replacing the loop with ffs/__ffs that would be more elegant,
shorter and avoid any problem or doubt?


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Bug in kernel code?
  2002-08-28  3:57                       ` Luca Barbieri
@ 2002-08-28  3:58                         ` David S. Miller
  2002-08-28  4:10                           ` Luca Barbieri
  0 siblings, 1 reply; 21+ messages in thread
From: David S. Miller @ 2002-08-28  3:58 UTC (permalink / raw)
  To: ldb; +Cc: s.biggs, linux-kernel

   From: Luca Barbieri <ldb@ldb.ods.org>
   Date: 28 Aug 2002 05:57:50 +0200

   On Wed, 2002-08-28 at 05:39, David S. Miller wrote:
   > Realistically possible with any known configuration?

   How about replacing the loop with ffs/__ffs that would be more
   elegant, shorter and avoid any problem or doubt?
   
This is getting rediculious.  You can pursue this further
if you want, but I think we've wasted enough time with
this non-bug.

Who is getting bootup failures due to this problem?
Answer: nobody

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Bug in kernel code?
  2002-08-28  4:10                           ` Luca Barbieri
@ 2002-08-28  4:07                             ` David S. Miller
  2002-08-28  4:29                               ` Luca Barbieri
  0 siblings, 1 reply; 21+ messages in thread
From: David S. Miller @ 2002-08-28  4:07 UTC (permalink / raw)
  To: ldb; +Cc: s.biggs, linux-kernel

   From: Luca Barbieri <ldb@ldb.ods.org>
   Date: 28 Aug 2002 06:10:39 +0200

   I'm not saying that it's serious bug, just that using __ffs is more
   appropriate than reimplementing it incorrectly and inefficiently.
   
ffs won't find the smallest power of 2 >= some_arbitrary_value.
That is what this code is doing.

I've personally wasted enough typing on this thread, so enough....

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Bug in kernel code?
  2002-08-28  3:58                         ` David S. Miller
@ 2002-08-28  4:10                           ` Luca Barbieri
  2002-08-28  4:07                             ` David S. Miller
  0 siblings, 1 reply; 21+ messages in thread
From: Luca Barbieri @ 2002-08-28  4:10 UTC (permalink / raw)
  To: David S. Miller; +Cc: s.biggs, Linux-Kernel ML

[-- Attachment #1: Type: text/plain, Size: 726 bytes --]

On Wed, 2002-08-28 at 05:58, David S. Miller wrote:
>    From: Luca Barbieri <ldb@ldb.ods.org>
>    Date: 28 Aug 2002 05:57:50 +0200
> 
>    On Wed, 2002-08-28 at 05:39, David S. Miller wrote:
>    > Realistically possible with any known configuration?
> 
>    How about replacing the loop with ffs/__ffs that would be more
>    elegant, shorter and avoid any problem or doubt?
>    
> This is getting rediculious.  You can pursue this further
> if you want, but I think we've wasted enough time with
> this non-bug.
> 
> Who is getting bootup failures due to this problem?
> Answer: nobody
I'm not saying that it's serious bug, just that using __ffs is more
appropriate than reimplementing it incorrectly and inefficiently.


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Bug in kernel code?
  2002-08-28  4:29                       ` Stephen Biggs
@ 2002-08-28  4:26                         ` David S. Miller
  2002-08-28 21:54                           ` H. Peter Anvin
  0 siblings, 1 reply; 21+ messages in thread
From: David S. Miller @ 2002-08-28  4:26 UTC (permalink / raw)
  To: s.biggs; +Cc: linux-kernel

   From: "Stephen Biggs" <s.biggs@softier.com>
   Date: Tue, 27 Aug 2002 21:29:06 -0700

   You tell me.  You're saying a billion pages (((unsigned long)(~0)) >> 2) also crashes) is never 
   going to be realistically possible?

On a 32-bit system?  No.  x86 cpus are architectually limited
to 64GB of memory, shift that right by PAGE_SIZE (13) and we're
still within bounds.

Larger memory will be then be found on 64-bit systems, and hey
then the limit becomes significantly higher.

So that is exactly what I am saying, it is not realistically
possible.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Bug in kernel code?
  2002-08-28  3:39                     ` David S. Miller
  2002-08-28  3:57                       ` Luca Barbieri
@ 2002-08-28  4:29                       ` Stephen Biggs
  2002-08-28  4:26                         ` David S. Miller
  1 sibling, 1 reply; 21+ messages in thread
From: Stephen Biggs @ 2002-08-28  4:29 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-kernel

On 27 Aug 2002 at 20:39, David S. Miller wrote:

>    How about (unsigned long)(~0)?
>    
> Realistically possible with any known configuration?
> 

You tell me.  You're saying a billion pages (((unsigned long)(~0)) >> 2) also crashes) is never 
going to be realistically possible?  Sounds like Bill Gates when he said (and I don't know the word-
for-word quote) "Who's ever going to need more than 640K??"  What if we get into 64 bit addressing? 
What if there is some sort of bug that passes all 1s on the stack for just this one instance?  
Never could "realistically" happen? Yeah, right; I've seen weirder things than that.

It's a question of mandatory paranoid sanity checking in an OS wherever possible.  Linux is trying 
to be known as robust.  Are you saying that a supposedly robust kernel should have a chance to 
crash in an infinite loop during initialization because there isn't code doing input validation 
when there isn't an optimization or speed issue?


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Bug in kernel code?
  2002-08-28  4:07                             ` David S. Miller
@ 2002-08-28  4:29                               ` Luca Barbieri
  0 siblings, 0 replies; 21+ messages in thread
From: Luca Barbieri @ 2002-08-28  4:29 UTC (permalink / raw)
  To: David S. Miller; +Cc: s.biggs, Linux-Kernel ML

[-- Attachment #1: Type: text/plain, Size: 442 bytes --]

On Wed, 2002-08-28 at 06:07, David S. Miller wrote:
>    From: Luca Barbieri <ldb@ldb.ods.org>
>    Date: 28 Aug 2002 06:10:39 +0200
> 
>    I'm not saying that it's serious bug, just that using __ffs is more
>    appropriate than reimplementing it incorrectly and inefficiently.
>    
> ffs won't find the smallest power of 2 >= some_arbitrary_value.
> That is what this code is doing.
Yes you are right, fls should be used there, not ffs.


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Bug in kernel code?
  2002-08-28  4:26                         ` David S. Miller
@ 2002-08-28 21:54                           ` H. Peter Anvin
  0 siblings, 0 replies; 21+ messages in thread
From: H. Peter Anvin @ 2002-08-28 21:54 UTC (permalink / raw)
  To: linux-kernel

Followup to:  <20020827.212649.102436426.davem@redhat.com>
By author:    "David S. Miller" <davem@redhat.com>
In newsgroup: linux.dev.kernel
>
>    From: "Stephen Biggs" <s.biggs@softier.com>
>    Date: Tue, 27 Aug 2002 21:29:06 -0700
> 
>    You tell me.  You're saying a billion pages (((unsigned long)(~0)) >> 2) also crashes) is never 
>    going to be realistically possible?
> 
> On a 32-bit system?  No.  x86 cpus are architectually limited
> to 64GB of memory, shift that right by PAGE_SIZE (13) and we're
> still within bounds.                   ^^^^^^^^^^^^^^
> 

PAGE_SHIFT, 12.

The maximum possible page count of any known 32-bit system (64 GB @ 4K
for x86) is 2^24 pages.

	-hpa
-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt	<amsp@zytor.com>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Bug in kernel code?
@ 2002-08-28  0:25 Stephen C. Biggs
  0 siblings, 0 replies; 21+ messages in thread
From: Stephen C. Biggs @ 2002-08-28  0:25 UTC (permalink / raw)
  To: linux-kernel

I posted this to the newsgroup news:linux-kernel but got no response... 
I'll try here.

While going thru the kernel code for 2.4.17 (uClinux patch) I noticed a 
problem with functions in 3 files:
dcache_init in fs/dcache.c, inode_init in fs/inode.c and in mnt_init in 
fs/namespace.c

At least on my Redhat 7.3 2.4.18-10 source, in the function

static void __init dcache_init(unsigned long mempages)
{
	struct list_head *d;
	unsigned long order;
	unsigned int nr_hash;
	int i;

	/* 
	 * A constructor could be added for stable state like the lists,
	 * but it is probably not worth it because of the cache nature
	 * of the dcache. 
	 * If fragmentation is too bad then the SLAB_HWCACHE_ALIGN
	 * flag could be removed here, to hint to the allocator that
	 * it should not try to get multiple page regions.  
	 */
	dentry_cache = kmem_cache_create("dentry_cache",
					 sizeof(struct dentry),
					 0,
					 SLAB_HWCACHE_ALIGN,
					 NULL, NULL);
	if (!dentry_cache)
		panic("Cannot create dentry cache");

#if PAGE_SHIFT < 13
	mempages >>= (13 - PAGE_SHIFT);
#endif
	mempages *= sizeof(struct list_head);
	for (order = 0; ((1UL << order) << PAGE_SHIFT) < mempages; order++)
		;

	do {
		u32 tmp;

		nr_hash = (1UL << order) * PAGE_SIZE /
			sizeof(struct list_head);
		d_hash_mask = (nr_hash - 1);

		tmp = nr_hash;
		d_hash_shift = 0;
		while ((tmp >>= 1UL) != 0UL)
			d_hash_shift++;

		dentry_hashtable = (struct list_head *)
			__get_free_pages(GFP_ATOMIC, order);
	} while (dentry_hashtable == NULL && --order >= 0);


........... 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?



^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2002-08-28 21:51 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <3D6BB5C3.16057.2E515C@localhost>
     [not found] ` <20020827.172304.22017977.davem@redhat.com>
2002-08-28  0:32   ` Bug in kernel code? Stephen C. Biggs
2002-08-28  0:29     ` David S. Miller
2002-08-28  0:40       ` Stephen C. Biggs
2002-08-28  0:42         ` David S. Miller
2002-08-28  1:09           ` Stephen C. Biggs
2002-08-28  1:09             ` David S. Miller
2002-08-28  1:24               ` Stephen C. Biggs
2002-08-28  1:23                 ` David S. Miller
2002-08-28  2:42                   ` Stephen C. Biggs
2002-08-28  3:39                     ` David S. Miller
2002-08-28  3:57                       ` Luca Barbieri
2002-08-28  3:58                         ` David S. Miller
2002-08-28  4:10                           ` Luca Barbieri
2002-08-28  4:07                             ` David S. Miller
2002-08-28  4:29                               ` Luca Barbieri
2002-08-28  4:29                       ` Stephen Biggs
2002-08-28  4:26                         ` David S. Miller
2002-08-28 21:54                           ` H. Peter Anvin
2002-08-28  2:49                   ` Re[2]: " Stephen C. Biggs
2002-08-28  0:54   ` Stephen C. Biggs
2002-08-28  0:25 Stephen C. Biggs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).