From: Stephen Warren Date: Wed, 22 May 2013 08:48:18 +0000 (+0000) Subject: input: fix unaligned access in key_matrix_decode_fdt() X-Git-Tag: v2013.07-rc1~27 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e573617c092eb49da2d67443725d755fca3e8b74;p=u-boot input: fix unaligned access in key_matrix_decode_fdt() 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 Acked-by: Simon Glass --- diff --git a/drivers/input/key_matrix.c b/drivers/input/key_matrix.c index 946a186a1f..c8b048e604 100644 --- a/drivers/input/key_matrix.c +++ b/drivers/input/key_matrix.c @@ -158,7 +158,7 @@ int key_matrix_decode_fdt(struct key_matrix *config, const void *blob, int node) { const struct fdt_property *prop; - const char prefix[] = "linux,"; + static const char prefix[] = "linux,"; int plen = sizeof(prefix) - 1; int offset;