[U-Boot] [PATCH] input: fix unaligned access in key_matrix_decode_fdt()

Simon Glass sjg at chromium.org
Sun May 26 21:28:22 CEST 2013


On Wed, May 22, 2013 at 11:48 AM, Stephen Warren <swarren at wwwdotorg.org>wrote:

> From: Stephen Warren <swarren at nvidia.com>
>
> Initialized character arrays on the stack can cause gcc to emit code that
> performs unaligned accessess. Make the data static to avoid this.
>
> Note that the unaligned accesses are made when copying data to prefix[] on
> the stack from .rodata. By making the data static, the copy is completely
> avoided. All explicitly written code treats the data as u8[], so will never
> cause any unaligned accesses.
>
> Signed-off-by: Stephen Warren <swarren at nvidia.com>
>

Acked-by: Simon Glass <sjg at chromium.org>

Thanks for fixing.

I hit this with gcc 4.7. I wonder if previous revisions would not make this
assumption?

Another problem I have is that the 'linux' in 'linux,keymap' in the device
compile turns into '1' since gcc predefines 'linux' to 1:

I think I'm going to add a -Ulinux to dts/Makefile.

Regards.
Simon


More information about the U-Boot mailing list