[PATCH 04/24] HWPOISON: return ENXIO on invalid pfn

From: Wu Fengguang
Date: Tue Dec 01 2009 - 23:38:40 EST


Return ENXIO to indicate "No such device or address".
This also avoids calling action_result() with invalid pfn.

CC: Andi Kleen <andi@xxxxxxxxxxxxxx>
Signed-off-by: Wu Fengguang <fengguang.wu@xxxxxxxxx>
---
mm/memory-failure.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

--- linux-mm.orig/mm/memory-failure.c 2009-11-02 10:26:17.000000000 +0800
+++ linux-mm/mm/memory-failure.c 2009-11-02 10:26:17.000000000 +0800
@@ -598,13 +598,11 @@ static struct page_state {

static void action_result(unsigned long pfn, char *msg, int result)
{
- struct page *page = NULL;
- if (pfn_valid(pfn))
- page = pfn_to_page(pfn);
+ struct page *page = pfn_to_page(pfn);

printk(KERN_ERR "MCE %#lx: %s%s page recovery: %s\n",
pfn,
- page && PageDirty(page) ? "dirty " : "",
+ PageDirty(page) ? "dirty " : "",
msg, action_name[result]);
}

@@ -730,8 +728,10 @@ int __memory_failure(unsigned long pfn,
panic("Memory failure from trap %d on page %lx", trapno, pfn);

if (!pfn_valid(pfn)) {
- action_result(pfn, "memory outside kernel control", IGNORED);
- return -EIO;
+ printk(KERN_ERR
+ "MCE %#lx: memory outside kernel control\n",
+ pfn);
+ return -ENXIO;
}

p = pfn_to_page(pfn);


--
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/