Commit af2d237b authored by Akinobu Mita's avatar Akinobu Mita Committed by Ingo Molnar

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: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 72d31053
...@@ -33,14 +33,16 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, ...@@ -33,14 +33,16 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
return 0; return 0;
vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE); vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
if (!vaddr)
return -ENOMEM;
if (userbuf) { if (userbuf) {
if (copy_to_user(buf, (vaddr + offset), csize)) { if (copy_to_user(buf, vaddr + offset, csize)) {
iounmap(vaddr); iounmap(vaddr);
return -EFAULT; return -EFAULT;
} }
} else } else
memcpy(buf, (vaddr + offset), csize); memcpy(buf, vaddr + offset, csize);
iounmap(vaddr); iounmap(vaddr);
return csize; return csize;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment