Skip to content

Commit

Permalink
x86: check for ioremap() failure in copy_oldmem_page()
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Akinobu Mita authored and Ingo Molnar committed Sep 22, 2008
1 parent 72d3105 commit af2d237
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions arch/x86/kernel/crash_dump_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
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;
Expand Down

0 comments on commit af2d237

Please sign in to comment.