x86: check for ioremap() failure in copy_oldmem_page()
PATCH 1/1 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.
--- arch/x86/kernel/crash_dump_64.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/x86/kernel/crash_dump_64.c +4 -2
@@ -33,14 +33,16 @@ ssize_t copy_oldmem_page(unsigned long preturn 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;
Ingo Molnar
AppliedQuoted 4 lines · Akinobu Mita
Add a check for
ioremap()failure incopy_oldmem_page(). This patch also includes small coding style fixes.Signed-off-by Akinobu Mita <[email protected]>
applied to tip/x86/crashdump, thanks!
I'm curious, have you found this bug via the fault-injection framework, or via code review?
Ingo
2008/9/22 Ingo Molnar <[email protected]>:
Quoted 6 lines · Akinobu Mita
Quoted 4 lines
Add a check for
ioremap()failure incopy_oldmem_page(). This patch also includes small coding style fixes.
Quoted 6 lines
Quoted 1 line
Signed-off-by Akinobu Mita <[email protected]>applied to tip/x86/crashdump, thanks!
I'm curious, have you found this bug via the fault-injection framework, or via code review?
I found it via code review.
But I forgot why I was looking at crash_dump_64.c...