linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: jarkko.nikula@bitmer.com (Jarkko Nikula)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/5] ARM: OMAP2+: clean up some cppcheck warnings
Date: Tue, 13 Mar 2012 09:10:02 +0200	[thread overview]
Message-ID: <4F5EF2CA.70703@bitmer.com> (raw)
In-Reply-To: <20120312224257.4103.11096.stgit@dusk>

On 03/13/2012 12:43 AM, Paul Walmsley wrote:
> Resolve some warnings identified by cppcheck in arch/arm/mach-omap2:
...
>     [arch/arm/mach-omap2/mcbsp.c:133]: (warning) scanf without field width limits can crash with huge input data
...
> diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
> index fb4bcf8..efe59c7 100644

> --- a/arch/arm/mach-omap2/mcbsp.c
> +++ b/arch/arm/mach-omap2/mcbsp.c
> @@ -130,7 +130,7 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
>  	struct omap_mcbsp_platform_data *pdata = NULL;
>  	struct platform_device *pdev;
>  
> -	sscanf(oh->name, "mcbsp%d", &id);
> +	sscanf(oh->name, "mcbsp%1d", &id);
>  
Correct if I'm wrong but is this a false alarm? Can %d scan more than
sizeof(int)?

Anyway this shouldn't be fatal issue since name comes from kernel
omap_hwmod data, i.e. only developer can hit it.

Peter: worth to check and possible add this Paul's fix to your mcbsp
change set.

-- 
Jarkko

  reply	other threads:[~2012-03-13  7:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-12 22:42 [PATCH 0/5] ARM: OMAP2+: resolve some warnings from sparse, cppcheck Paul Walmsley
2012-03-12 22:42 ` [PATCH 1/5] ARM: OMAP2+: declare file-local functions as static Paul Walmsley
2012-03-13  7:12   ` Shilimkar, Santosh
2012-03-12 22:42 ` [PATCH 2/5] ARM: OMAP2+: add includes for missing prototypes Paul Walmsley
2012-03-13  6:53   ` Shilimkar, Santosh
2012-03-12 22:42 ` [PATCH 3/5] ARM: OMAP2+: GPMC: resolve type-conversion warning from sparse Paul Walmsley
2012-03-12 22:42 ` [PATCH 4/5] ARM: OMAP2+: fix 'using plain integer as NULL pointer' sparse warnings Paul Walmsley
2012-03-12 22:43 ` [PATCH 5/5] ARM: OMAP2+: clean up some cppcheck warnings Paul Walmsley
2012-03-13  7:10   ` Jarkko Nikula [this message]
2012-03-13  8:07     ` Paul Walmsley
2012-03-13  8:12   ` [PATCH v2 " Paul Walmsley
2012-03-13  8:21     ` Varadarajan, Charulatha
2012-03-13  8:44     ` [PATCH v3 " Paul Walmsley

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=4F5EF2CA.70703@bitmer.com \
    --to=jarkko.nikula@bitmer.com \
    --cc=linux-arm-kernel@lists.infradead.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).