[PATCH] x86: check for ioremap() failure in copy_oldmem_page()

From: Akinobu Mita
Date: Sun Sep 21 2008 - 10:27:29 EST


Add a check for ioremap() failure in copy_oldmem_page().
This patch also includes small coding style fixes.

Signed-off-by: Akinobu Mita <akinobu.mita@xxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
---
arch/x86/kernel/crash_dump_64.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

Index: 2.6-git/arch/x86/kernel/crash_dump_64.c
===================================================================
--- 2.6-git.orig/arch/x86/kernel/crash_dump_64.c
+++ 2.6-git/arch/x86/kernel/crash_dump_64.c
@@ -33,14 +33,16 @@ ssize_t copy_oldmem_page(unsigned long p
return 0;

vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
+ if (!vaddr)
+ return -ENOMEM;

if (userbuf) {
- if (copy_to_user(buf, (vaddr + offset), csize)) {
+ if (copy_to_user(buf, vaddr + offset, csize)) {
iounmap(vaddr);
return -EFAULT;
}
} else
- memcpy(buf, (vaddr + offset), csize);
+ memcpy(buf, vaddr + offset, csize);

iounmap(vaddr);
return csize;
--
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/