mm/madvise.c: fix return value of madvise_hwpoison()
authorWanpeng Li <liwanp@linux.vnet.ibm.com>
Wed, 11 Sep 2013 21:23:02 +0000 (14:23 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 11 Sep 2013 22:58:12 +0000 (15:58 -0700)
The return value outside for loop is always zero which means
madvise_hwpoison return success, however, this is not truth for
soft_offline_page w/ failure return value.

Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/madvise.c

index 30293ab95b065e45ce3e3dd7b7d906f0bcf299e5..51bffa4140277f8d0420a4aa3028a7afd4799baa 100644 (file)
@@ -361,7 +361,7 @@ static int madvise_hwpoison(int bhv, unsigned long start, unsigned long end)
                                page_to_pfn(p), start);
                        ret = soft_offline_page(p, MF_COUNT_INCREASED);
                        if (ret)
-                               break;
+                               return ret;
                        continue;
                }
                pr_info("Injecting memory failure for page %#lx at %#lx\n",