public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] input: fix unaligned access in key_matrix_decode_fdt()
@ 2013-05-22 18:48 Stephen Warren
  2013-05-26 19:28 ` Simon Glass
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Stephen Warren @ 2013-05-22 18:48 UTC (permalink / raw)
  To: u-boot

From: Stephen Warren <swarren@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@nvidia.com>
---
 drivers/input/key_matrix.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/key_matrix.c b/drivers/input/key_matrix.c
index 946a186..c8b048e 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;
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-06-06 14:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-22 18:48 [U-Boot] [PATCH] input: fix unaligned access in key_matrix_decode_fdt() Stephen Warren
2013-05-26 19:28 ` Simon Glass
2013-05-26 20:55   ` Wolfgang Denk
2013-05-26 21:29     ` Simon Glass
2013-05-28  4:07   ` Stephen Warren
2013-06-04 19:29 ` Stephen Warren
2013-06-05 12:34 ` [U-Boot] " Tom Rini
2013-06-06 14:47   ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox