Skip to content
Snippets Groups Projects
Commit e573617c authored by Stephen Warren's avatar Stephen Warren Committed by Tom Rini
Browse files

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: default avatarStephen Warren <swarren@nvidia.com>
Acked-by: default avatarSimon Glass <sjg@chromium.org>
parent b8521b74
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment