lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150511144110.GR28183@kernel.org>
Date:	Mon, 11 May 2015 11:41:10 -0300
From:	Arnaldo Carvalho de Melo <acme@...nel.org>
To:	Namhyung Kim <namhyung@...nel.org>
Cc:	Ingo Molnar <mingo@...nel.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Jiri Olsa <jolsa@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>,
	David Ahern <dsahern@...il.com>,
	Joonsoo Kim <js1304@...il.com>,
	Minchan Kim <minchan@...nel.org>,
	Pekka Enberg <penberg@...nel.org>, linux-mm@...ck.org
Subject: Re: [PATCH 4/6] perf kmem: Print gfp flags in human readable string

Em Mon, May 11, 2015 at 11:35:36AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Apr 21, 2015 at 01:55:05PM +0900, Namhyung Kim escreveu:
> > Save libtraceevent output and print it in the header.
> 
> <SNIP>
> 
> > +static int parse_gfp_flags(struct perf_evsel *evsel, struct perf_sample *sample,
> > +			   unsigned int gfp_flags)
> > +{
> > +	char *str, *pos;

> > +	str = strtok_r(seq.buffer, " ", &pos);
> 
> builtin-kmem.c:743:427: error: ‘pos’ may be used uninitialized in this
> function [-Werror=maybe-uninitialized]
>     new->human_readable = strdup(str + 10);
>                                                                                                                                                                                                                                                                                                                                                                                                                                            ^
> builtin-kmem.c:716:14: note: ‘pos’ was declared here
>   char *str, *pos;
>               ^

Emphasis on the "may", as according to strtok_r your code is ok, its
just the compiler that needs to be told that no, it is not being
accessed uninitialized:

<quote man strtok>
       On the first call to strtok_r(), str should point to the string
to be parsed, and the value of saveptr is ignored.  In subsequent calls,
str should be NULL, and saveptr should be unchanged since the previous
call.
</>

So just setting it to NULL is enough.

- Arnaldo

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ