From: Andrew Morton Date: Wed, 11 Sep 2013 21:23:03 +0000 (-0700) Subject: mm/madvise.c:madvise_hwpoison(): remove local `ret' X-Git-Tag: firefly_0821_release~176^2~5340^2~164 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=325c4ef5c4b17372c3222d896040d7848e67fbdb;p=firefly-linux-kernel-4.4.55.git mm/madvise.c:madvise_hwpoison(): remove local `ret' madvise_hwpoison() has two locals called "ret". Fix it all up. Cc: Wanpeng Li Cc: Naoya Horiguchi Cc: Andi Kleen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/madvise.c b/mm/madvise.c index 51bffa414027..6975bc812542 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -343,15 +343,16 @@ static long madvise_remove(struct vm_area_struct *vma, */ static int madvise_hwpoison(int bhv, unsigned long start, unsigned long end) { - int ret = 0; - if (!capable(CAP_SYS_ADMIN)) return -EPERM; for (; start < end; start += PAGE_SIZE) { struct page *p; - int ret = get_user_pages_fast(start, 1, 0, &p); + int ret; + + ret = get_user_pages_fast(start, 1, 0, &p); if (ret != 1) return ret; + if (PageHWPoison(p)) { put_page(p); continue; @@ -369,7 +370,7 @@ static int madvise_hwpoison(int bhv, unsigned long start, unsigned long end) /* Ignore return value for now */ memory_failure(page_to_pfn(p), 0, MF_COUNT_INCREASED); } - return ret; + return 0; } #endif