JFFS2: unaligned accesses may happen in jffs2_sum_process_sum_data

Nicholas Krause xerofoify at gmail.com
Thu Mar 12 09:23:27 PDT 2015



On March 11, 2015 9:50:01 PM EDT, wang.bo116 at zte.com.cn wrote:
>
>	In JFFS2 summary, "#define JFFS2_SUMMARY_DIRENT_SIZE(x) (sizeof(struct
>jffs2_sum_dirent_flash) + (x))",because of x here is dir's name, the
>result of JFFS2_SUMMARY_DIRENT_SIZE may be unaligned. So in function
>"jffs2_sum_process_sum_data", may access unaligned pointer "sp" when
>excute "switch (je16_to_cpu(((struct jffs2_sum_unknown_flash
>*)sp)->nodetype))".
>
>	Some machine not allowed unaligned accesses, for example, in linux
>mips systerms, unaligned accesses may cause a exception,but luckly,in
>linux, function "handle_adel" can handle it well.But when JFFS2 use in
>other operating systerm, this unaligned accesses may be a problem.
>
>	To fix it,the simple way is redefine JFFS2_SUMMARY_DIRENT_SIZE like
>"#define JFFS2_SUMMARY_DIRENT_SIZE(x) PAD((sizeof(struct
>jffs2_sum_dirent_flash) + (x)))",make it aligned.But the problem is
>that SUMMARY became incompatible!
>
>
>
>
>Are you stating that this is a build issue or causing a bug with hardware that needs this marco unaligned. 
Nick 
>Linux MTD discussion mailing list
>http://lists.infradead.org/mailman/listinfo/linux-mtd/

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.



More information about the linux-mtd mailing list