* [PATCH] tools lib traceevent: fix an incorrect comparison with the literal "s64"
@ 2017-11-27 16:19 Colin King
2017-12-01 0:21 ` Steven Rostedt
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2017-11-27 16:19 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Steven Rostedt, David S . Miller,
Daniel Borkmann
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
I believe the comparison of the string 'type' with the literal string
"s64" is currently incorrect, it is missing a == 0 comparison as per
the other comparisons.
Detected by cppcheck:
tools/lib/traceevent/event-parse.c:2209: (warning) The comparison
operator in 'strcmp(type,"s64") != 0' should maybe be '==' instead,
currently the expression 'strcmp(type,"u64") == 0' is redundant.
Fixes: f7d82350e597 ("tools/events: Add files to create libtraceevent.a")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
tools/lib/traceevent/event-parse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 7ce724fc0544..82b6c64c5b39 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -2206,7 +2206,7 @@ eval_type_str(unsigned long long val, const char *type, int pointer)
return val & 0xffffffff;
if (strcmp(type, "u64") == 0 ||
- strcmp(type, "s64"))
+ strcmp(type, "s64") == 0)
return val;
if (strcmp(type, "s8") == 0)
--
2.14.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] tools lib traceevent: fix an incorrect comparison with the literal "s64"
2017-11-27 16:19 [PATCH] tools lib traceevent: fix an incorrect comparison with the literal "s64" Colin King
@ 2017-12-01 0:21 ` Steven Rostedt
0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2017-12-01 0:21 UTC (permalink / raw)
To: Colin King
Cc: Arnaldo Carvalho de Melo, David S . Miller, Daniel Borkmann,
kernel-janitors, linux-kernel
Arnaldo,
Can you take this in your tree. And mark it for stable. Thanks!
On Mon, 27 Nov 2017 16:19:09 +0000
Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> I believe the comparison of the string 'type' with the literal string
> "s64" is currently incorrect, it is missing a == 0 comparison as per
> the other comparisons.
>
> Detected by cppcheck:
> tools/lib/traceevent/event-parse.c:2209: (warning) The comparison
> operator in 'strcmp(type,"s64") != 0' should maybe be '==' instead,
> currently the expression 'strcmp(type,"u64") == 0' is redundant.
>
> Fixes: f7d82350e597 ("tools/events: Add files to create libtraceevent.a")
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-- Steve
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> tools/lib/traceevent/event-parse.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
> index 7ce724fc0544..82b6c64c5b39 100644
> --- a/tools/lib/traceevent/event-parse.c
> +++ b/tools/lib/traceevent/event-parse.c
> @@ -2206,7 +2206,7 @@ eval_type_str(unsigned long long val, const char *type, int pointer)
> return val & 0xffffffff;
>
> if (strcmp(type, "u64") == 0 ||
> - strcmp(type, "s64"))
> + strcmp(type, "s64") == 0)
> return val;
>
> if (strcmp(type, "s8") == 0)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-01 0:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-27 16:19 [PATCH] tools lib traceevent: fix an incorrect comparison with the literal "s64" Colin King
2017-12-01 0:21 ` Steven Rostedt
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).