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>] [day] [month] [year] [list]
Message-ID: <tip-m3501el55i10hctfbmi2qxzr@git.kernel.org>
Date:   Thu, 16 Feb 2017 12:03:00 -0800
From:   tip-bot for Arnaldo Carvalho de Melo <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, acme@...hat.com, tglx@...utronix.de,
        adrian.hunter@...el.com, namhyung@...nel.org, dsahern@...il.com,
        jolsa@...nel.org, hpa@...or.com, wangnan0@...wei.com,
        mhiramat@...nel.org, mingo@...nel.org
Subject: [tip:perf/core] perf probe: Avoid accessing uninitialized 'map'
 variable

Commit-ID:  8a2efd6dd586ef0ff532180e6335ec21310c2cd5
Gitweb:     http://git.kernel.org/tip/8a2efd6dd586ef0ff532180e6335ec21310c2cd5
Author:     Arnaldo Carvalho de Melo <acme@...hat.com>
AuthorDate: Tue, 14 Feb 2017 15:28:41 -0300
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Tue, 14 Feb 2017 15:28:41 -0300

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@...el.com>
Cc: David Ahern <dsahern@...il.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Masami Hiramatsu <mhiramat@...nel.org>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Wang Nan <wangnan0@...wei.com>
Link: http://lkml.kernel.org/n/tip-m3501el55i10hctfbmi2qxzr@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.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 2c1bca2..35f5b7b 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;
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ