From: "Sachin P. Sant" <sachinp@in.ibm.com>
To: linuxppc-dev@ozlabs.org
Cc: paulus@samba.org, Fastboot mailing list <fastboot@lists.osdl.org>
Subject: [PATCH] kdump: don't call __ioremap() for pfn = 0
Date: Thu, 21 Sep 2006 10:07:02 +0530 [thread overview]
Message-ID: <451216EE.8010404@in.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 517 bytes --]
Hi
While using dd command to retrive the dump from /dev/oldmem, there comes
a rare case where pfn value is zero. In this case the __ioremap() call
returns
NULL and hence copying fails.
# dd if=/dev/oldmem of=/dev/null
dd: reading `/dev/oldmem': Bad address
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000121 seconds, 0.0 kB/s
Attached is a patch to fix this problem. During such rare cases don't call
__ioremap() to do the address translation, instead use __va() .
Tested with 2.6.18.
Thanks
-Sachin
[-- Attachment #2: kdump-no-ioremap-for-pfn-zero-fix --]
[-- Type: text/plain, Size: 1027 bytes --]
* During some rare cases [like using dd command with /dev/oldmem] the pfn value
can be zero. Do not call __ioremap for zero pfn value, instead use __va to
calculate the virtual address.
Signed-off-by: Sachin Sant <sachinp@in.ibm.com>
diff -Naurp a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
--- a/arch/powerpc/kernel/crash_dump.c 2006-09-20 09:12:06.000000000 +0530
+++ b/arch/powerpc/kernel/crash_dump.c 2006-09-21 09:06:35.000000000 +0530
@@ -101,7 +101,15 @@ ssize_t copy_oldmem_page(unsigned long p
if (!csize)
return 0;
- vaddr = __ioremap(pfn << PAGE_SHIFT, PAGE_SIZE, 0);
+ /* During some rare cases [like using dd command with /dev/oldmem]
+ * the pfn value can be zero. Do not call __ioremap for zero
+ * pfn value, instead use __va to calculate the virtual address.
+ */
+
+ if (pfn == 0)
+ vaddr = __va(pfn << PAGE_SHIFT);
+ else
+ vaddr = __ioremap(pfn << PAGE_SHIFT, PAGE_SIZE, 0);
if (userbuf) {
if (copy_to_user((char __user *)buf, (vaddr + offset), csize)) {
next reply other threads:[~2006-09-21 4:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-21 4:37 Sachin P. Sant [this message]
2006-09-21 11:02 ` [PATCH] kdump: don't call __ioremap() for pfn = 0 Michael Ellerman
2006-09-21 14:10 ` [Fastboot] " Vivek Goyal
2006-09-22 6:55 ` Michael Ellerman
2006-09-22 4:22 ` Sachin P. Sant
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=451216EE.8010404@in.ibm.com \
--to=sachinp@in.ibm.com \
--cc=fastboot@lists.osdl.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.