lkml.org 
[lkml]   [2003]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH][2.4.23-pre4] page_alloc uninitialised variable bug
mm/page_alloc in 2.4.23-pre4 triggers this warning:

page_alloc.c: In function `balance_classzone':
page_alloc.c:259: warning: `__freed' might be used uninitialized in this function

There is a case where balance_classzone() returns NULL and an
uninitialised value in *freed, and the caller, __alloc_pages(),
also uses the uninitialised value.

Changing balance_classzone() to not do "*freed = __freed;" in
this case is inadequate since __alloc_pages() will still look
at the bogus value. Someone needs to initialise the damn thing;
the patch below makes balance_classzone() do it.

/Mikael

--- linux-2.4.23-pre4/mm/page_alloc.c.~1~ 2003-09-13 19:11:48.000000000 +0200
+++ linux-2.4.23-pre4/mm/page_alloc.c 2003-09-13 20:58:56.000000000 +0200
@@ -256,7 +256,7 @@
static struct page * balance_classzone(zone_t * classzone, unsigned int gfp_mask, unsigned int order, int * freed)
{
struct page * page = NULL;
- int __freed;
+ int __freed = 0;

if (!(gfp_mask & __GFP_WAIT))
goto out;
-
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:48    [W:0.035 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site