public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] trace/function-graph: Fix build warning on 32-bit
@ 2010-09-29  7:38 Borislav Petkov
  2010-09-29  8:08 ` [PATCH -v1.2] " Borislav Petkov
  0 siblings, 1 reply; 3+ messages in thread
From: Borislav Petkov @ 2010-09-29  7:38 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Chase Douglas, Frederic Weisbecker, lkml

Fix

kernel/trace/trace_functions_graph.c: In function ‘trace_print_graph_duration’:
kernel/trace/trace_functions_graph.c:652: warning: comparison of distinct pointer types lacks a cast

when building 36-rc6 on a 32-bit due to the strict type check failing in
the min() macro.

Signed-off-by: Borislav Petkov <bp@alien8.de>
---
 kernel/trace/trace_functions_graph.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 6f23369..4eab958 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -649,8 +649,10 @@ trace_print_graph_duration(unsigned long long duration, struct trace_seq *s)
 
 	/* Print nsecs (we don't want to exceed 7 numbers) */
 	if (len < 7) {
-		snprintf(nsecs_str, min(sizeof(nsecs_str), 8UL - len), "%03lu",
-			 nsecs_rem);
+		unsigned long slen = min_t(unsigned long, sizeof(nsecs_str),
+							  8UL - len);
+
+		snprintf(nsecs_str, slen, "%03lu", nsecs_rem);
 		ret = trace_seq_printf(s, ".%s", nsecs_str);
 		if (!ret)
 			return TRACE_TYPE_PARTIAL_LINE;
-- 
1.7.2.3


-- 
Regards/Gruss,
    Boris.

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

* [PATCH -v1.2] trace/function-graph: Fix build warning on 32-bit
  2010-09-29  7:38 [PATCH] trace/function-graph: Fix build warning on 32-bit Borislav Petkov
@ 2010-09-29  8:08 ` Borislav Petkov
  2010-09-29 13:40   ` Frederic Weisbecker
  0 siblings, 1 reply; 3+ messages in thread
From: Borislav Petkov @ 2010-09-29  8:08 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Chase Douglas, Frederic Weisbecker, lkml

> Fix
> 
> kernel/trace/trace_functions_graph.c: In function ‘trace_print_graph_duration’:
> kernel/trace/trace_functions_graph.c:652: warning: comparison of distinct pointer types lacks a cast

sh*t, I got completely carried away with all that typechecking, take
this one instead:

--
From: Borislav Petkov <bp@alien8.de>
Date: Wed, 29 Sep 2010 08:39:43 +0200
Subject: [PATCH] trace/function-graph: Fix build warning on 32-bit
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fix

kernel/trace/trace_functions_graph.c: In function ‘trace_print_graph_duration’:
kernel/trace/trace_functions_graph.c:652: warning: comparison of distinct pointer types lacks a cast

when building 36-rc6 on a 32-bit due to the strict type check failing in
the min() macro.

Signed-off-by: Borislav Petkov <bp@alien8.de>
---
 kernel/trace/trace_functions_graph.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 6f23369..82306cc 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -649,8 +649,9 @@ trace_print_graph_duration(unsigned long long duration, struct trace_seq *s)
 
 	/* Print nsecs (we don't want to exceed 7 numbers) */
 	if (len < 7) {
-		snprintf(nsecs_str, min(sizeof(nsecs_str), 8UL - len), "%03lu",
-			 nsecs_rem);
+		size_t slen = min_t(size_t, sizeof(nsecs_str), 8UL - len);
+
+		snprintf(nsecs_str, slen, "%03lu", nsecs_rem);
 		ret = trace_seq_printf(s, ".%s", nsecs_str);
 		if (!ret)
 			return TRACE_TYPE_PARTIAL_LINE;
-- 
1.7.2.3

-- 
Regards/Gruss,
    Boris.

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

* Re: [PATCH -v1.2] trace/function-graph: Fix build warning on 32-bit
  2010-09-29  8:08 ` [PATCH -v1.2] " Borislav Petkov
@ 2010-09-29 13:40   ` Frederic Weisbecker
  0 siblings, 0 replies; 3+ messages in thread
From: Frederic Weisbecker @ 2010-09-29 13:40 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: Steven Rostedt, Chase Douglas, lkml

On Wed, Sep 29, 2010 at 10:08:23AM +0200, Borislav Petkov wrote:
> > Fix
> > 
> > kernel/trace/trace_functions_graph.c: In function ‘trace_print_graph_duration’:
> > kernel/trace/trace_functions_graph.c:652: warning: comparison of distinct pointer types lacks a cast
> 
> sh*t, I got completely carried away with all that typechecking, take
> this one instead:
> 
> --


Queued, thanks!



> From: Borislav Petkov <bp@alien8.de>
> Date: Wed, 29 Sep 2010 08:39:43 +0200
> Subject: [PATCH] trace/function-graph: Fix build warning on 32-bit
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> Fix
> 
> kernel/trace/trace_functions_graph.c: In function ‘trace_print_graph_duration’:
> kernel/trace/trace_functions_graph.c:652: warning: comparison of distinct pointer types lacks a cast
> 
> when building 36-rc6 on a 32-bit due to the strict type check failing in
> the min() macro.
> 
> Signed-off-by: Borislav Petkov <bp@alien8.de>
> ---
>  kernel/trace/trace_functions_graph.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
> index 6f23369..82306cc 100644
> --- a/kernel/trace/trace_functions_graph.c
> +++ b/kernel/trace/trace_functions_graph.c
> @@ -649,8 +649,9 @@ trace_print_graph_duration(unsigned long long duration, struct trace_seq *s)
>  
>  	/* Print nsecs (we don't want to exceed 7 numbers) */
>  	if (len < 7) {
> -		snprintf(nsecs_str, min(sizeof(nsecs_str), 8UL - len), "%03lu",
> -			 nsecs_rem);
> +		size_t slen = min_t(size_t, sizeof(nsecs_str), 8UL - len);
> +
> +		snprintf(nsecs_str, slen, "%03lu", nsecs_rem);
>  		ret = trace_seq_printf(s, ".%s", nsecs_str);
>  		if (!ret)
>  			return TRACE_TYPE_PARTIAL_LINE;
> -- 
> 1.7.2.3
> 
> -- 
> Regards/Gruss,
>     Boris.


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

end of thread, other threads:[~2010-09-29 13:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-29  7:38 [PATCH] trace/function-graph: Fix build warning on 32-bit Borislav Petkov
2010-09-29  8:08 ` [PATCH -v1.2] " Borislav Petkov
2010-09-29 13:40   ` Frederic Weisbecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox