android_kernel_samsung_a7y1.../tools
Numfor Mbiziwo-Tiapo 23d5ded095 perf header: Fix use of unitialized value warning
[ Upstream commit 20f9781f491360e7459c589705a2e4b1f136bee9 ]

When building our local version of perf with MSAN (Memory Sanitizer) and
running the perf record command, MSAN throws a use of uninitialized
value warning in "tools/perf/util/util.c:333:6".

This warning stems from the "buf" variable being passed into "write".
It originated as the variable "ev" with the type union perf_event*
defined in the "perf_event__synthesize_attr" function in
"tools/perf/util/header.c".

In the "perf_event__synthesize_attr" function they allocate space with a malloc
call using ev, then go on to only assign some of the member variables before
passing "ev" on as a parameter to the "process" function therefore "ev"
contains uninitialized memory. Changing the malloc call to zalloc to initialize
all the members of "ev" which gets rid of the warning.

To reproduce this warning, build perf by running:
make -C tools/perf CLANG=1 CC=clang EXTRA_CFLAGS="-fsanitize=memory\
 -fsanitize-memory-track-origins"

(Additionally, llvm might have to be installed and clang might have to
be specified as the compiler - export CC=/usr/bin/clang)

then running:
tools/perf/perf record -o - ls / | tools/perf/perf --no-pager annotate\
 -i - --stdio

Please see the cover letter for why false positive warnings may be
generated.

Signed-off-by: Numfor Mbiziwo-Tiapo <nums@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Drayton <mbd@fb.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/20190724234500.253358-2-nums@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-06 20:48:56 +02:00
..
arch A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
build A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
cgroup A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
firewire A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
hv A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iio iio: iio-utils: Fix possible incorrect mask calculation 2020-04-06 20:06:12 +02:00
include tools include: Adopt linux/bits.h 2020-04-06 18:15:26 +02:00
laptop/freefall A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
lguest A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
lib tools lib traceevent: Fix missing equality check for strcmp 2020-04-06 16:43:37 +02:00
net A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
nfsd A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
perf perf header: Fix use of unitialized value warning 2020-04-06 20:48:56 +02:00
power cpupower : frequency-set -r option misses the last cpu in related cpu list 2020-04-06 19:54:39 +02:00
scripts A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
testing selftests/net: correct the return value for run_netsocktests 2020-04-06 16:47:10 +02:00
thermal/tmon A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
time A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
usb A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
virtio A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
vm A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile A750FXXU4CTBC 2020-03-27 21:51:54 +05:30