From: KOSAKI Motohiro Date: Tue, 16 Dec 2008 07:06:43 +0000 (+0900) Subject: mm: Don't touch uninitialized variable in do_pages_stat_array() X-Git-Tag: v2.6.28-rc9~16 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=c095adbc211f9f4e990eac7d6cb440de35e4f05f;p=linux-2.6-omap-h63xx.git mm: Don't touch uninitialized variable in do_pages_stat_array() Commit 80bba1290ab5122c60cdb73332b26d288dc8aedd removed one necessary variable initialization. As a result following warning happened: 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 CC: Brice Goglin Cc: Christoph Lameter Cc: KAMEZAWA Hiroyuki Cc: Nick Piggin Cc: Hugh Dickins Signed-off-by: Linus Torvalds --- diff --git a/mm/migrate.c b/mm/migrate.c index d8f07667fc8..037b0967c1e 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -998,7 +998,7 @@ static void do_pages_stat_array(struct mm_struct *mm, unsigned long nr_pages, 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)