linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: d binderman <dcb314@hotmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: arch/arm/mach-omap2/mux.c: Off by one error
Date: Mon, 1 Feb 2010 13:06:33 -0800	[thread overview]
Message-ID: <20100201210633.GC22747@atomide.com> (raw)
In-Reply-To: <BLU108-W14539E61D58BF455B82CA59C590@phx.gbl>

* d binderman <dcb314@hotmail.com> [100131 04:14]:
> 
> 
> Hello there,
> 
> I just ran the sourceforge tool cppcheck over the source code of the
> new Linux kernel 2.6.33-rc6
> 
> It said
> 
> [./arm/mach-omap2/mux.c:492]: (error) Buffer access out-of-bounds
> 
> The source code is
> 
>         char mode[14];
>         int i = -1;
> 
>         sprintf(mode, "OMAP_MUX_MODE%d", val & 0x7);
> 
> 13 characters + 1 digit + 1 zero byte is more than 14 characters.
> 
> Suggest new code
> 
>         char mode[15];
>         int i = -1;
> 
>         sprintf(mode, "OMAP_MUX_MODE%d", val & 0x7);

Thanks for reporting this.

I'll queue up the following fix for this for 2.6.34.

Regards,

Tony

From: Tony Lindgren <tony@atomide.com>
Date: Mon, 1 Feb 2010 13:03:42 -0800
Subject: [PATCH] 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.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>

diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 32764be..047aa57 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -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)
 {
 	char *flags[OMAP_MUX_MAX_NR_FLAGS];
-	char mode[14];
+	char mode[15];
 	int i = -1;
 
 	sprintf(mode, "OMAP_MUX_MODE%d", val & 0x7);

  reply	other threads:[~2010-02-01 21:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-31 12:16 arch/arm/mach-omap2/mux.c: Off by one error d binderman
2010-02-01 21:06 ` Tony Lindgren [this message]
2010-02-01 21:17   ` Joe Perches
2010-02-01 22:05     ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100201210633.GC22747@atomide.com \
    --to=tony@atomide.com \
    --cc=dcb314@hotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).