Commit 78737ae1 authored by Tony Lindgren's avatar Tony Lindgren

omap: Fix arch/arm/mach-omap2/mux.c: Off by one error

David Binderman ran the sourceforge tool cppcheck over the source code of the
new Linux kernel 2.6.33-rc6:

[./arm/mach-omap2/mux.c:492]: (error) Buffer access out-of-bounds

13 characters + 1 digit + 1 zero byte is more than 14 characters.

Also add a comment on mode0 name length in case new omaps
start using longer names.
Reported-by: default avatarDavid Binderman <dcb314@hotmail.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 9ecef433
...@@ -486,7 +486,7 @@ int __init omap_mux_init_signal(char *muxname, int val) ...@@ -486,7 +486,7 @@ int __init omap_mux_init_signal(char *muxname, int val)
static inline void omap_mux_decode(struct seq_file *s, u16 val) static inline void omap_mux_decode(struct seq_file *s, u16 val)
{ {
char *flags[OMAP_MUX_MAX_NR_FLAGS]; char *flags[OMAP_MUX_MAX_NR_FLAGS];
char mode[14]; char mode[sizeof("OMAP_MUX_MODE") + 1];
int i = -1; int i = -1;
sprintf(mode, "OMAP_MUX_MODE%d", val & 0x7); sprintf(mode, "OMAP_MUX_MODE%d", val & 0x7);
...@@ -553,6 +553,7 @@ static int omap_mux_dbg_board_show(struct seq_file *s, void *unused) ...@@ -553,6 +553,7 @@ static int omap_mux_dbg_board_show(struct seq_file *s, void *unused)
if (!m0_name) if (!m0_name)
continue; continue;
/* REVISIT: Needs to be updated if mode0 names get longer */
for (i = 0; i < OMAP_MUX_DEFNAME_LEN; i++) { for (i = 0; i < OMAP_MUX_DEFNAME_LEN; i++) {
if (m0_name[i] == '\0') { if (m0_name[i] == '\0') {
m0_def[i] = m0_name[i]; m0_def[i] = m0_name[i];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment