Index: drivers/mtd/cmdlinepart.c =================================================================== RCS file: /home/cvs/mtd/drivers/mtd/cmdlinepart.c,v retrieving revision 1.10 diff -u -r1.10 cmdlinepart.c --- drivers/mtd/cmdlinepart.c 29 May 2003 09:25:22 -0000 1.10 +++ drivers/mtd/cmdlinepart.c 31 Jul 2003 23:48:20 -0000 @@ -241,6 +241,7 @@ &num_parts, /* out: number of parts */ 0, /* first partition */ (unsigned char**)&this_mtd, /* out: extra mem */ + __alignof__(*this_mtd) - 1 + mtd_id_len + 1 + sizeof(*this_mtd)); if(!parts) { @@ -252,7 +253,21 @@ * unlikely to succeed in parsing any more */ return 0; - } + } + + if ((unsigned long)(this_mtd) & (__alignof__(*this_mtd) - 1)) + { + /* Some archs do not allow non-aligned accesses + * within the kernel. So make sure we're properly + * aligned here. + */ + unsigned long fixup = (unsigned long) this_mtd; + dbg(("this_mtd: 0x%0x\n", this_mtd)); + fixup += __alignof__(*this_mtd) - 1; + fixup &= ~(__alignof__(*this_mtd) - 1); + this_mtd = (struct cmdline_mtd_partition *) fixup; + dbg(("this_mtd: 0x%0x (aligned)\n", this_mtd)); + } /* enter results */ this_mtd->parts = parts;