public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Richter <rric@kernel.org>
To: Masanari Iida <standby24x7@gmail.com>
Cc: oprofile-list@lists.sf.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] oprofile: Fix format string mismatch in oprofile_perf.c
Date: Tue, 29 Apr 2014 10:12:57 +0200	[thread overview]
Message-ID: <20140429081257.GH32718@rric.localhost> (raw)
In-Reply-To: <1398730940-2151-1-git-send-email-standby24x7@gmail.com>

On 29.04.14 09:22:20, Masanari Iida wrote:
> Fix format string mismatch in oprofile_perf_create_files.

Please provide a compiler warning.

> 
> Signed-off-by: Masanari Iida <standby24x7@gmail.com>
> ---
>  drivers/oprofile/oprofile_perf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/oprofile/oprofile_perf.c b/drivers/oprofile/oprofile_perf.c
> index d5b2732..968e6dc 100644
> --- a/drivers/oprofile/oprofile_perf.c
> +++ b/drivers/oprofile/oprofile_perf.c
> @@ -146,7 +146,7 @@ static int oprofile_perf_create_files(struct dentry *root)

        unsigned int i;

        for (i = 0; i < num_counters; i++) {

>  		struct dentry *dir;
>  		char buf[4];
>  
> -		snprintf(buf, sizeof buf, "%d", i);
> +		snprintf(buf, sizeof buf, "%u", i);

Since num_counters is int we better fix this by changing the i
declaration to int which avoids comparing unsigned/signed.

-Robert

>  		dir = oprofilefs_mkdir(root, buf);
>  		oprofilefs_create_ulong(dir, "enabled", &counter_config[i].enabled);
>  		oprofilefs_create_ulong(dir, "event", &counter_config[i].event);
> -- 
> 2.0.0.rc1
> 

      reply	other threads:[~2014-04-29  8:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-29  0:22 [PATCH] oprofile: Fix format string mismatch in oprofile_perf.c Masanari Iida
2014-04-29  8:12 ` Robert Richter [this message]

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=20140429081257.GH32718@rric.localhost \
    --to=rric@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oprofile-list@lists.sf.net \
    --cc=standby24x7@gmail.com \
    /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