[PATCH for 2.6.28] mm: Don't touch uninitialized variable in do_pages_stat_array()

From: KOSAKI Motohiro
Date: Tue Dec 16 2008 - 02:07:17 EST



80bba1290ab5122c60cdb73332b26d288dc8aedd remove one necessary variable initialization.
Then, following warning happend.

CC mm/migrate.o
mm/migrate.c: In function 'sys_move_pages':
mm/migrate.c:1001: warning: 'err' may be used uninitialized in this function

More unfortunately, if find_vma() failed, kernel read uninitialized memory.



Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>
CC: Brice Goglin <Brice.Goglin@xxxxxxxx>
Cc: Christoph Lameter <clameter@xxxxxxx>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
Cc: Nick Piggin <npiggin@xxxxxxx>
Cc: Hugh Dickins <hugh@xxxxxxxxxxx>
---
mm/migrate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/mm/migrate.c
===================================================================
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -998,7 +998,7 @@ static void do_pages_stat_array(struct m
unsigned long addr = (unsigned long)(*pages);
struct vm_area_struct *vma;
struct page *page;
- int err;
+ int err = -EFAULT;

vma = find_vma(mm, addr);
if (!vma)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/