kernel oops due to unaligned access with lswi

Olaf Hering olh at suse.de
Sun Nov 16 09:24:30 EST 2003


 On Sat, Nov 15, Olaf Hering wrote:

>
> Alan,
>
> 2.6 has a function parse_header(), its part of gunzip and used for
> initramfs as example. I got an oops, exception 600, sig 7. I think that
> means unaligned access.

This might be a useable workaround.

--- ../linuxppc-2.5_2.6.0-test9-bk.orig/init/initramfs.c        2003-10-18 17:25:50.000000000 +0200
+++ init/initramfs.c    2003-11-15 23:09:57.000000000 +0100
@@ -100,11 +100,11 @@ static void __init parse_header(char *s)
 {
        unsigned long parsed[12];
        char buf[9];
-       int i;
+       int i, j = 1;

        buf[8] = '\0';
        for (i = 0, s += 6; i < 12; i++, s += 8) {
-               memcpy(buf, s, 8);
+               memcpy(buf, s, 7 + j); /* s might be unaligned, gcc will optimized the call to lswi on ppc */
                parsed[i] = simple_strtoul(buf, NULL, 16);
        }
        ino = parsed[0];


--
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-dev mailing list