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
* 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 <[EMAIL PROTECTED]>

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)) {
_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot

Reply via email to