From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Colin Ian King <colin.king@canonical.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>,
Wang Nan <wangnan0@huawei.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf probe: check if *ptr2 is zero and not ptr2
Date: Mon, 3 Oct 2016 08:45:44 -0300 [thread overview]
Message-ID: <20161003114544.GB12073@kernel.org> (raw)
In-Reply-To: <57F23F71.1060509@canonical.com>
Em Mon, Oct 03, 2016 at 12:22:25PM +0100, Colin Ian King escreveu:
> On 03/10/16 12:19, Arnaldo Carvalho de Melo wrote:
> > Em Mon, Oct 03, 2016 at 11:34:31AM +0100, Colin King escreveu:
> >> From: Colin Ian King <colin.king@canonical.com>
> >>
> >> Static anaylsis with cppcheck detected an incorrect comparison:
> >> [tools/perf/util/probe-event.c:216]: (warning) Char literal compared with
> >> pointer 'ptr2'. Did you intend to dereference it?
> >
> > What tool was used for that?
>
> cppcheck https://github.com/danmar/cppcheck - I run it nearly daily on
> linux-next and linux
Thanks, I'll try to get it and use it before upstreaming stuff,
- Arnaldo
> >
> > - Arnaldo
> >
> >> Dereference ptr2 for the comparison to fix this.
> >>
> >> Fixes: 35726d3a4ca9 ("perf probe: Fix to cut off incompatible chars from group name")
> >> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> >> ---
> >> tools/perf/util/probe-event.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> >> index fcfbef0..d281ae2 100644
> >> --- a/tools/perf/util/probe-event.c
> >> +++ b/tools/perf/util/probe-event.c
> >> @@ -213,7 +213,7 @@ static int convert_exec_to_group(const char *exec, char **result)
> >> goto out;
> >> }
> >>
> >> - for (ptr2 = ptr1; ptr2 != '\0'; ptr2++) {
> >> + for (ptr2 = ptr1; *ptr2 != '\0'; ptr2++) {
> >> if (!isalnum(*ptr2) && *ptr2 != '_') {
> >> *ptr2 = '\0';
> >> break;
> >> --
> >> 2.9.3
next prev parent reply other threads:[~2016-10-03 11:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-03 10:34 [PATCH] perf probe: check if *ptr2 is zero and not ptr2 Colin King
2016-10-03 11:19 ` Arnaldo Carvalho de Melo
2016-10-03 11:22 ` Colin Ian King
2016-10-03 11:45 ` Arnaldo Carvalho de Melo [this message]
2016-10-04 2:28 ` Masami Hiramatsu
2016-10-04 8:09 ` [tip:perf/urgent] perf probe: Check " tip-bot for Colin Ian King
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=20161003114544.GB12073@kernel.org \
--to=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=colin.king@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@linux.vnet.ibm.com \
--cc=wangnan0@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.