diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-02-14 15:28:41 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-02-14 15:28:41 -0300 |
commit | 8a2efd6dd586ef0ff532180e6335ec21310c2cd5 (patch) | |
tree | 5aee2df82f9c7e61dd3b2be2601ba84a28da468b /tools/perf | |
parent | 89896051f8dae5a04ada1f5fbeeaedc23f484f68 (diff) | |
download | linux-8a2efd6dd586ef0ff532180e6335ec21310c2cd5.tar.bz2 |
perf probe: Avoid accessing uninitialized 'map' variable
Genuine problem detected with clang, the warnings are spot on:
util/probe-event.c:2079:7: error: variable 'map' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (addr) {
^~~~
util/probe-event.c:2094:6: note: uninitialized use occurs here
if (map && !is_kprobe) {
^~~
util/probe-event.c:2079:3: note: remove the 'if' if its condition is always true
if (addr) {
^~~~~~~~~~
util/probe-event.c:2075:8: error: variable 'map' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (kernel_get_symbol_address_by_name(tp->symbol,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
util/probe-event.c:2094:6: note: uninitialized use occurs here
if (map && !is_kprobe) {
^~~
util/probe-event.c:2075:4: note: remove the 'if' if its condition is always false
if (kernel_get_symbol_address_by_name(tp->symbol,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
util/probe-event.c:2064:17: note: initialize the variable 'map' to silence this warning
struct map *map;
^
= NULL
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-m3501el55i10hctfbmi2qxzr@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/probe-event.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 2c1bca240597..35f5b7b7715c 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -2061,7 +2061,7 @@ static int find_perf_probe_point_from_map(struct probe_trace_point *tp, bool is_kprobe) { struct symbol *sym = NULL; - struct map *map; + struct map *map = NULL; u64 addr = tp->address; int ret = -ENOENT; |