public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] oprofile: Fix format string mismatch in oprofile_perf.c
@ 2014-04-29  0:22 Masanari Iida
  2014-04-29  8:12 ` Robert Richter
  0 siblings, 1 reply; 2+ messages in thread
From: Masanari Iida @ 2014-04-29  0:22 UTC (permalink / raw)
  To: rric, oprofile-list, linux-kernel; +Cc: Masanari Iida

Fix format string mismatch in oprofile_perf_create_files.

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)
 		struct dentry *dir;
 		char buf[4];
 
-		snprintf(buf, sizeof buf, "%d", i);
+		snprintf(buf, sizeof buf, "%u", i);
 		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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] oprofile: Fix format string mismatch in oprofile_perf.c
  2014-04-29  0:22 [PATCH] oprofile: Fix format string mismatch in oprofile_perf.c Masanari Iida
@ 2014-04-29  8:12 ` Robert Richter
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Richter @ 2014-04-29  8:12 UTC (permalink / raw)
  To: Masanari Iida; +Cc: oprofile-list, linux-kernel

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
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-29  8:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox