JFFS2: unaligned accesses may happen in jffs2_sum_process_sum_data

wang.bo116 at zte.com.cn wang.bo116 at zte.com.cn
Mon Mar 16 00:00:24 PDT 2015




Nicholas Krause <xerofoify at gmail.com> wrote on 2015-03-13 00:23:27:

> From: Nicholas Krause <xerofoify at gmail.com>
> To: wang.bo116 at zte.com.cn, linux-mtd at lists.infradead.org, dwmw2 at infradead.org,
> Cc: cui.yunfeng at zte.com.cn, wang.haitao1 at zte.com.cn, liu.song11 at zte.com.cn, deng.chao1 at zte.com.cn
> Date: 2015-03-13 00:23
> Subject: Re: JFFS2: unaligned accesses may happen in jffs2_sum_process_sum_data
>
>
>
> 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


I think this may causing a bug with hardware that needs address aligned,and lose some efficiency.




More information about the linux-mtd mailing list