Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1494843
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] perf probe: check if *ptr2 is zero and not ptr2 |
| Date | 2016-10-03 13:50 +0200 |
| Message-ID | <so9US-4lz-3@gated-at.bofh.it> (permalink) |
| References | <so8P7-3JR-13@gated-at.bofh.it> <so9rP-4ca-7@gated-at.bofh.it> <so9Bv-4fq-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] perf probe: check if *ptr2 is zero and not ptr2 Colin King <colin.king@canonical.com> - 2016-10-03 12:40 +0200
Re: [PATCH] perf probe: check if *ptr2 is zero and not ptr2 Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-03 13:20 +0200
Re: [PATCH] perf probe: check if *ptr2 is zero and not ptr2 Colin Ian King <colin.king@canonical.com> - 2016-10-03 13:30 +0200
Re: [PATCH] perf probe: check if *ptr2 is zero and not ptr2 Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-03 13:50 +0200
Re: [PATCH] perf probe: check if *ptr2 is zero and not ptr2 Masami Hiramatsu <mhiramat@kernel.org> - 2016-10-04 04:30 +0200
[tip:perf/urgent] perf probe: Check if *ptr2 is zero and not ptr2 tip-bot for Colin Ian King <tipbot@zytor.com> - 2016-10-04 10:20 +0200
csiph-web