[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-7a6d49dc8cad8fa1f3d63994102af8f9ae9c859f@git.kernel.org>
Date: Sat, 13 Jul 2019 03:55:16 -0700
From: tip-bot for Leo Yan <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: songliubraving@...com, linux@...musvillemoes.dk,
alexios.zavras@...el.com, davem@...emloft.net,
tmricht@...ux.ibm.com, ak@...ux.intel.com, dave@...olabs.net,
linux-kernel@...r.kernel.org, leo.yan@...aro.org,
adrian.hunter@...el.com, mingo@...nel.org,
alexey.budankov@...ux.intel.com, mathieu.poirier@...aro.org,
hpa@...or.com, changbin.du@...el.com, namhyung@...nel.org,
peterz@...radead.org, eric.saint.etienne@...cle.com,
khlebnikov@...dex-team.ru, suzuki.poulose@....com,
yao.jin@...ux.intel.com, tglx@...utronix.de,
alexander.shishkin@...ux.intel.com, acme@...hat.com,
jolsa@...nel.org
Subject: [tip:perf/urgent] perf trace: Fix potential NULL pointer
dereference found by the smatch tool
Commit-ID: 7a6d49dc8cad8fa1f3d63994102af8f9ae9c859f
Gitweb: https://git.kernel.org/tip/7a6d49dc8cad8fa1f3d63994102af8f9ae9c859f
Author: Leo Yan <leo.yan@...aro.org>
AuthorDate: Tue, 2 Jul 2019 18:34:14 +0800
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Tue, 9 Jul 2019 09:33:55 -0300
perf trace: Fix potential NULL pointer dereference found by the smatch tool
Based on the following report from Smatch, fix the potential NULL
pointer dereference check.
tools/perf/builtin-trace.c:1044
thread_trace__new() error: we previously assumed 'ttrace' could be
null (see line 1041).
tools/perf/builtin-trace.c
1037 static struct thread_trace *thread_trace__new(void)
1038 {
1039 struct thread_trace *ttrace = zalloc(sizeof(struct thread_trace));
1040
1041 if (ttrace)
1042 ttrace->files.max = -1;
1043
1044 ttrace->syscall_stats = intlist__new(NULL);
^^^^^^^^
1045
1046 return ttrace;
1047 }
Signed-off-by: Leo Yan <leo.yan@...aro.org>
Acked-by: Jiri Olsa <jolsa@...nel.org>
Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Alexey Budankov <alexey.budankov@...ux.intel.com>
Cc: Alexios Zavras <alexios.zavras@...el.com>
Cc: Andi Kleen <ak@...ux.intel.com>
Cc: Changbin Du <changbin.du@...el.com>
Cc: David S. Miller <davem@...emloft.net>
Cc: Davidlohr Bueso <dave@...olabs.net>
Cc: Eric Saint-Etienne <eric.saint.etienne@...cle.com>
Cc: Jin Yao <yao.jin@...ux.intel.com>
Cc: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
Cc: Mathieu Poirier <mathieu.poirier@...aro.org>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: Song Liu <songliubraving@...com>
Cc: Suzuki Poulouse <suzuki.poulose@....com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Thomas Richter <tmricht@...ux.ibm.com>
Cc: linux-arm-kernel@...ts.infradead.org
Link: http://lkml.kernel.org/r/20190702103420.27540-6-leo.yan@linaro.org
[ Just made it look like other tools/perf constructors, same end result ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/builtin-trace.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index d0eb7224dd36..e3fc9062f136 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1038,10 +1038,10 @@ static struct thread_trace *thread_trace__new(void)
{
struct thread_trace *ttrace = zalloc(sizeof(struct thread_trace));
- if (ttrace)
+ if (ttrace) {
ttrace->files.max = -1;
-
- ttrace->syscall_stats = intlist__new(NULL);
+ ttrace->syscall_stats = intlist__new(NULL);
+ }
return ttrace;
}
Powered by blists - more mailing lists