Skip to content

Commit af2d237

Browse files
mitaIngo Molnar
authored andcommitted
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 <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent 72d3105 commit af2d237

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arch/x86/kernel/crash_dump_64.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,16 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
3333
return 0;
3434

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

3739
if (userbuf) {
38-
if (copy_to_user(buf, (vaddr + offset), csize)) {
40+
if (copy_to_user(buf, vaddr + offset, csize)) {
3941
iounmap(vaddr);
4042
return -EFAULT;
4143
}
4244
} else
43-
memcpy(buf, (vaddr + offset), csize);
45+
memcpy(buf, vaddr + offset, csize);
4446

4547
iounmap(vaddr);
4648
return csize;

0 commit comments

Comments
 (0)