lkml.org 
[lkml]   [2008]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] x86: check for ioremap() failure in copy_oldmem_page()
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@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
---
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;

\
 
 \ /
  Last update: 2008-09-21 16:29    [W:0.058 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site