* [PATCH v2 0/4] perf: Fix errors detected by Smatch
@ 2019-07-08 14:39 ` Leo Yan
0 siblings, 0 replies; 22+ messages in thread
From: Leo Yan @ 2019-07-08 14:39 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
Namhyung Kim, Mathieu Poirier, Suzuki K Poulose, Adrian Hunter,
Andi Kleen, linux-kernel, linux-arm-kernel
Cc: Leo Yan
Since Arnaldo has picked up several patches from patch set v1 and have
left four patches which are needed to be refined based on the feedback.
So this is patch set v2 which contains the rest four patches with
addressed the comments and suggestions.
Changes from v1:
* Added WARN_ON_ONCE(!hbt) in ui/browsers/hists.c (Jiri)
* Removed NULL test for 'session->itrace_synth_opts (Adrian)
Leo Yan (4):
perf hists: Smatch: Fix potential NULL pointer dereference
perf intel-bts: Smatch: Fix potential NULL pointer dereference
perf intel-pt: Smatch: Fix potential NULL pointer dereference
perf cs-etm: Smatch: Fix potential NULL pointer dereference
tools/perf/ui/browsers/hists.c | 15 +++++++++++----
tools/perf/util/cs-etm.c | 2 +-
tools/perf/util/intel-bts.c | 5 ++---
tools/perf/util/intel-pt.c | 13 +++++--------
4 files changed, 19 insertions(+), 16 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 0/4] perf: Fix errors detected by Smatch
@ 2019-07-08 14:39 ` Leo Yan
0 siblings, 0 replies; 22+ messages in thread
From: Leo Yan @ 2019-07-08 14:39 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
Namhyung Kim, Mathieu Poirier, Suzuki K Poulose, Adrian Hunter,
Andi Kleen, linux-kernel, linux-arm-kernel
Cc: Leo Yan
Since Arnaldo has picked up several patches from patch set v1 and have
left four patches which are needed to be refined based on the feedback.
So this is patch set v2 which contains the rest four patches with
addressed the comments and suggestions.
Changes from v1:
* Added WARN_ON_ONCE(!hbt) in ui/browsers/hists.c (Jiri)
* Removed NULL test for 'session->itrace_synth_opts (Adrian)
Leo Yan (4):
perf hists: Smatch: Fix potential NULL pointer dereference
perf intel-bts: Smatch: Fix potential NULL pointer dereference
perf intel-pt: Smatch: Fix potential NULL pointer dereference
perf cs-etm: Smatch: Fix potential NULL pointer dereference
tools/perf/ui/browsers/hists.c | 15 +++++++++++----
tools/perf/util/cs-etm.c | 2 +-
tools/perf/util/intel-bts.c | 5 ++---
tools/perf/util/intel-pt.c | 13 +++++--------
4 files changed, 19 insertions(+), 16 deletions(-)
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 1/4] perf hists: Smatch: Fix potential NULL pointer dereference
2019-07-08 14:39 ` Leo Yan
@ 2019-07-08 14:39 ` Leo Yan
-1 siblings, 0 replies; 22+ messages in thread
From: Leo Yan @ 2019-07-08 14:39 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
Namhyung Kim, Mathieu Poirier, Suzuki K Poulose, Adrian Hunter,
Andi Kleen, linux-kernel, linux-arm-kernel
Cc: Leo Yan
Based on the following report from Smatch, fix the potential
NULL pointer dereference check.
tools/perf/ui/browsers/hists.c:641
hist_browser__run() error: we previously assumed 'hbt' could be
null (see line 625)
tools/perf/ui/browsers/hists.c:3088
perf_evsel__hists_browse() error: we previously assumed
'browser->he_selection' could be null (see line 2902)
tools/perf/ui/browsers/hists.c:3272
perf_evsel_menu__run() error: we previously assumed 'hbt' could be
null (see line 3260)
This patch firstly validating the pointers before access them, so can
fix potential NULL pointer dereference.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/ui/browsers/hists.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 85581cfb9112..a94eb0755e8b 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -639,7 +639,11 @@ int hist_browser__run(struct hist_browser *browser, const char *help,
switch (key) {
case K_TIMER: {
u64 nr_entries;
- hbt->timer(hbt->arg);
+
+ WARN_ON_ONCE(!hbt);
+
+ if (hbt)
+ hbt->timer(hbt->arg);
if (hist_browser__has_filter(browser) ||
symbol_conf.report_hierarchy)
@@ -2821,7 +2825,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
{
struct hists *hists = evsel__hists(evsel);
struct hist_browser *browser = perf_evsel_browser__new(evsel, hbt, env, annotation_opts);
- struct branch_info *bi;
+ struct branch_info *bi = NULL;
#define MAX_OPTIONS 16
char *options[MAX_OPTIONS];
struct popup_action actions[MAX_OPTIONS];
@@ -3087,7 +3091,9 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
goto skip_annotation;
if (sort__mode == SORT_MODE__BRANCH) {
- bi = browser->he_selection->branch_info;
+
+ if (browser->he_selection)
+ bi = browser->he_selection->branch_info;
if (bi == NULL)
goto skip_annotation;
@@ -3271,7 +3277,8 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu,
switch (key) {
case K_TIMER:
- hbt->timer(hbt->arg);
+ if (hbt)
+ hbt->timer(hbt->arg);
if (!menu->lost_events_warned &&
menu->lost_events &&
--
2.17.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 1/4] perf hists: Smatch: Fix potential NULL pointer dereference
@ 2019-07-08 14:39 ` Leo Yan
0 siblings, 0 replies; 22+ messages in thread
From: Leo Yan @ 2019-07-08 14:39 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
Namhyung Kim, Mathieu Poirier, Suzuki K Poulose, Adrian Hunter,
Andi Kleen, linux-kernel, linux-arm-kernel
Cc: Leo Yan
Based on the following report from Smatch, fix the potential
NULL pointer dereference check.
tools/perf/ui/browsers/hists.c:641
hist_browser__run() error: we previously assumed 'hbt' could be
null (see line 625)
tools/perf/ui/browsers/hists.c:3088
perf_evsel__hists_browse() error: we previously assumed
'browser->he_selection' could be null (see line 2902)
tools/perf/ui/browsers/hists.c:3272
perf_evsel_menu__run() error: we previously assumed 'hbt' could be
null (see line 3260)
This patch firstly validating the pointers before access them, so can
fix potential NULL pointer dereference.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/ui/browsers/hists.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 85581cfb9112..a94eb0755e8b 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -639,7 +639,11 @@ int hist_browser__run(struct hist_browser *browser, const char *help,
switch (key) {
case K_TIMER: {
u64 nr_entries;
- hbt->timer(hbt->arg);
+
+ WARN_ON_ONCE(!hbt);
+
+ if (hbt)
+ hbt->timer(hbt->arg);
if (hist_browser__has_filter(browser) ||
symbol_conf.report_hierarchy)
@@ -2821,7 +2825,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
{
struct hists *hists = evsel__hists(evsel);
struct hist_browser *browser = perf_evsel_browser__new(evsel, hbt, env, annotation_opts);
- struct branch_info *bi;
+ struct branch_info *bi = NULL;
#define MAX_OPTIONS 16
char *options[MAX_OPTIONS];
struct popup_action actions[MAX_OPTIONS];
@@ -3087,7 +3091,9 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
goto skip_annotation;
if (sort__mode == SORT_MODE__BRANCH) {
- bi = browser->he_selection->branch_info;
+
+ if (browser->he_selection)
+ bi = browser->he_selection->branch_info;
if (bi == NULL)
goto skip_annotation;
@@ -3271,7 +3277,8 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu,
switch (key) {
case K_TIMER:
- hbt->timer(hbt->arg);
+ if (hbt)
+ hbt->timer(hbt->arg);
if (!menu->lost_events_warned &&
menu->lost_events &&
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 2/4] perf intel-bts: Smatch: Fix potential NULL pointer dereference
2019-07-08 14:39 ` Leo Yan
@ 2019-07-08 14:39 ` Leo Yan
-1 siblings, 0 replies; 22+ messages in thread
From: Leo Yan @ 2019-07-08 14:39 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
Namhyung Kim, Mathieu Poirier, Suzuki K Poulose, Adrian Hunter,
Andi Kleen, linux-kernel, linux-arm-kernel
Cc: Leo Yan
Based on the following report from Smatch, fix the potential
NULL pointer dereference check.
tools/perf/util/intel-bts.c:898
intel_bts_process_auxtrace_info() error: we previously assumed
'session->itrace_synth_opts' could be null (see line 894)
tools/perf/util/intel-bts.c:899
intel_bts_process_auxtrace_info() warn: variable dereferenced before
check 'session->itrace_synth_opts' (see line 898)
tools/perf/util/intel-bts.c
894 if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
895 bts->synth_opts = *session->itrace_synth_opts;
896 } else {
897 itrace_synth_opts__set_default(&bts->synth_opts,
898 session->itrace_synth_opts->default_no_sample);
^^^^^^^^^^^^^^^^^^^^^^^^^^
899 if (session->itrace_synth_opts)
^^^^^^^^^^^^^^^^^^^^^^^^^^
900 bts->synth_opts.thread_stack =
901 session->itrace_synth_opts->thread_stack;
902 }
'session->itrace_synth_opts' is impossible to be a NULL pointer in
intel_bts_process_auxtrace_info(), thus this patch removes the NULL
test for 'session->itrace_synth_opts'.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
tools/perf/util/intel-bts.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c
index 5a21bcdb8ef7..5560e95afdda 100644
--- a/tools/perf/util/intel-bts.c
+++ b/tools/perf/util/intel-bts.c
@@ -891,13 +891,12 @@ int intel_bts_process_auxtrace_info(union perf_event *event,
if (dump_trace)
return 0;
- if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
+ if (session->itrace_synth_opts->set) {
bts->synth_opts = *session->itrace_synth_opts;
} else {
itrace_synth_opts__set_default(&bts->synth_opts,
session->itrace_synth_opts->default_no_sample);
- if (session->itrace_synth_opts)
- bts->synth_opts.thread_stack =
+ bts->synth_opts.thread_stack =
session->itrace_synth_opts->thread_stack;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 2/4] perf intel-bts: Smatch: Fix potential NULL pointer dereference
@ 2019-07-08 14:39 ` Leo Yan
0 siblings, 0 replies; 22+ messages in thread
From: Leo Yan @ 2019-07-08 14:39 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
Namhyung Kim, Mathieu Poirier, Suzuki K Poulose, Adrian Hunter,
Andi Kleen, linux-kernel, linux-arm-kernel
Cc: Leo Yan
Based on the following report from Smatch, fix the potential
NULL pointer dereference check.
tools/perf/util/intel-bts.c:898
intel_bts_process_auxtrace_info() error: we previously assumed
'session->itrace_synth_opts' could be null (see line 894)
tools/perf/util/intel-bts.c:899
intel_bts_process_auxtrace_info() warn: variable dereferenced before
check 'session->itrace_synth_opts' (see line 898)
tools/perf/util/intel-bts.c
894 if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
895 bts->synth_opts = *session->itrace_synth_opts;
896 } else {
897 itrace_synth_opts__set_default(&bts->synth_opts,
898 session->itrace_synth_opts->default_no_sample);
^^^^^^^^^^^^^^^^^^^^^^^^^^
899 if (session->itrace_synth_opts)
^^^^^^^^^^^^^^^^^^^^^^^^^^
900 bts->synth_opts.thread_stack =
901 session->itrace_synth_opts->thread_stack;
902 }
'session->itrace_synth_opts' is impossible to be a NULL pointer in
intel_bts_process_auxtrace_info(), thus this patch removes the NULL
test for 'session->itrace_synth_opts'.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
tools/perf/util/intel-bts.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c
index 5a21bcdb8ef7..5560e95afdda 100644
--- a/tools/perf/util/intel-bts.c
+++ b/tools/perf/util/intel-bts.c
@@ -891,13 +891,12 @@ int intel_bts_process_auxtrace_info(union perf_event *event,
if (dump_trace)
return 0;
- if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
+ if (session->itrace_synth_opts->set) {
bts->synth_opts = *session->itrace_synth_opts;
} else {
itrace_synth_opts__set_default(&bts->synth_opts,
session->itrace_synth_opts->default_no_sample);
- if (session->itrace_synth_opts)
- bts->synth_opts.thread_stack =
+ bts->synth_opts.thread_stack =
session->itrace_synth_opts->thread_stack;
}
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 3/4] perf intel-pt: Smatch: Fix potential NULL pointer dereference
2019-07-08 14:39 ` Leo Yan
@ 2019-07-08 14:39 ` Leo Yan
-1 siblings, 0 replies; 22+ messages in thread
From: Leo Yan @ 2019-07-08 14:39 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
Namhyung Kim, Mathieu Poirier, Suzuki K Poulose, Adrian Hunter,
Andi Kleen, linux-kernel, linux-arm-kernel
Cc: Leo Yan
Based on the following report from Smatch, fix the potential
NULL pointer dereference check.
tools/perf/util/intel-pt.c:3200
intel_pt_process_auxtrace_info() error: we previously assumed
'session->itrace_synth_opts' could be null (see line 3196)
tools/perf/util/intel-pt.c:3206
intel_pt_process_auxtrace_info() warn: variable dereferenced before
check 'session->itrace_synth_opts' (see line 3200)
tools/perf/util/intel-pt.c
3196 if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
3197 pt->synth_opts = *session->itrace_synth_opts;
3198 } else {
3199 itrace_synth_opts__set_default(&pt->synth_opts,
3200 session->itrace_synth_opts->default_no_sample);
^^^^^^^^^^^^^^^^^^^^^^^^^^
3201 if (!session->itrace_synth_opts->default_no_sample &&
3202 !session->itrace_synth_opts->inject) {
3203 pt->synth_opts.branches = false;
3204 pt->synth_opts.callchain = true;
3205 }
3206 if (session->itrace_synth_opts)
^^^^^^^^^^^^^^^^^^^^^^^^^^
3207 pt->synth_opts.thread_stack =
3208 session->itrace_synth_opts->thread_stack;
3209 }
'session->itrace_synth_opts' is impossible to be a NULL pointer in
intel_pt_process_auxtrace_info(), thus this patch removes the NULL
test for 'session->itrace_synth_opts'.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
tools/perf/util/intel-pt.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index c76a96f777fb..df061599fef4 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -3210,7 +3210,7 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
goto err_delete_thread;
}
- if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
+ if (session->itrace_synth_opts->set) {
pt->synth_opts = *session->itrace_synth_opts;
} else {
itrace_synth_opts__set_default(&pt->synth_opts,
@@ -3220,8 +3220,7 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
pt->synth_opts.branches = false;
pt->synth_opts.callchain = true;
}
- if (session->itrace_synth_opts)
- pt->synth_opts.thread_stack =
+ pt->synth_opts.thread_stack =
session->itrace_synth_opts->thread_stack;
}
@@ -3241,11 +3240,9 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
pt->cbr2khz = tsc_freq / pt->max_non_turbo_ratio / 1000;
}
- if (session->itrace_synth_opts) {
- err = intel_pt_setup_time_ranges(pt, session->itrace_synth_opts);
- if (err)
- goto err_delete_thread;
- }
+ err = intel_pt_setup_time_ranges(pt, session->itrace_synth_opts);
+ if (err)
+ goto err_delete_thread;
if (pt->synth_opts.calls)
pt->branches_filter |= PERF_IP_FLAG_CALL | PERF_IP_FLAG_ASYNC |
--
2.17.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 3/4] perf intel-pt: Smatch: Fix potential NULL pointer dereference
@ 2019-07-08 14:39 ` Leo Yan
0 siblings, 0 replies; 22+ messages in thread
From: Leo Yan @ 2019-07-08 14:39 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
Namhyung Kim, Mathieu Poirier, Suzuki K Poulose, Adrian Hunter,
Andi Kleen, linux-kernel, linux-arm-kernel
Cc: Leo Yan
Based on the following report from Smatch, fix the potential
NULL pointer dereference check.
tools/perf/util/intel-pt.c:3200
intel_pt_process_auxtrace_info() error: we previously assumed
'session->itrace_synth_opts' could be null (see line 3196)
tools/perf/util/intel-pt.c:3206
intel_pt_process_auxtrace_info() warn: variable dereferenced before
check 'session->itrace_synth_opts' (see line 3200)
tools/perf/util/intel-pt.c
3196 if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
3197 pt->synth_opts = *session->itrace_synth_opts;
3198 } else {
3199 itrace_synth_opts__set_default(&pt->synth_opts,
3200 session->itrace_synth_opts->default_no_sample);
^^^^^^^^^^^^^^^^^^^^^^^^^^
3201 if (!session->itrace_synth_opts->default_no_sample &&
3202 !session->itrace_synth_opts->inject) {
3203 pt->synth_opts.branches = false;
3204 pt->synth_opts.callchain = true;
3205 }
3206 if (session->itrace_synth_opts)
^^^^^^^^^^^^^^^^^^^^^^^^^^
3207 pt->synth_opts.thread_stack =
3208 session->itrace_synth_opts->thread_stack;
3209 }
'session->itrace_synth_opts' is impossible to be a NULL pointer in
intel_pt_process_auxtrace_info(), thus this patch removes the NULL
test for 'session->itrace_synth_opts'.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
tools/perf/util/intel-pt.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index c76a96f777fb..df061599fef4 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -3210,7 +3210,7 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
goto err_delete_thread;
}
- if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
+ if (session->itrace_synth_opts->set) {
pt->synth_opts = *session->itrace_synth_opts;
} else {
itrace_synth_opts__set_default(&pt->synth_opts,
@@ -3220,8 +3220,7 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
pt->synth_opts.branches = false;
pt->synth_opts.callchain = true;
}
- if (session->itrace_synth_opts)
- pt->synth_opts.thread_stack =
+ pt->synth_opts.thread_stack =
session->itrace_synth_opts->thread_stack;
}
@@ -3241,11 +3240,9 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
pt->cbr2khz = tsc_freq / pt->max_non_turbo_ratio / 1000;
}
- if (session->itrace_synth_opts) {
- err = intel_pt_setup_time_ranges(pt, session->itrace_synth_opts);
- if (err)
- goto err_delete_thread;
- }
+ err = intel_pt_setup_time_ranges(pt, session->itrace_synth_opts);
+ if (err)
+ goto err_delete_thread;
if (pt->synth_opts.calls)
pt->branches_filter |= PERF_IP_FLAG_CALL | PERF_IP_FLAG_ASYNC |
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 4/4] perf cs-etm: Smatch: Fix potential NULL pointer dereference
2019-07-08 14:39 ` Leo Yan
@ 2019-07-08 14:39 ` Leo Yan
-1 siblings, 0 replies; 22+ messages in thread
From: Leo Yan @ 2019-07-08 14:39 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
Namhyung Kim, Mathieu Poirier, Suzuki K Poulose, Adrian Hunter,
Andi Kleen, linux-kernel, linux-arm-kernel
Cc: Leo Yan
Based on the following report from Smatch, fix the potential
NULL pointer dereference check.
tools/perf/util/cs-etm.c:2545
cs_etm__process_auxtrace_info() error: we previously assumed
'session->itrace_synth_opts' could be null (see line 2541)
tools/perf/util/cs-etm.c
2541 if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
2542 etm->synth_opts = *session->itrace_synth_opts;
2543 } else {
2544 itrace_synth_opts__set_default(&etm->synth_opts,
2545 session->itrace_synth_opts->default_no_sample);
^^^^^^^^^^^^^^^^^^^^^^^^^^
2546 etm->synth_opts.callchain = false;
2547 }
'session->itrace_synth_opts' is impossible to be a NULL pointer in
cs_etm__process_auxtrace_info(), thus this patch removes the NULL
test for 'session->itrace_synth_opts'.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
tools/perf/util/cs-etm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index ad43a6e31827..ab578a06a790 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -2537,7 +2537,7 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
return 0;
}
- if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
+ if (session->itrace_synth_opts->set) {
etm->synth_opts = *session->itrace_synth_opts;
} else {
itrace_synth_opts__set_default(&etm->synth_opts,
--
2.17.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 4/4] perf cs-etm: Smatch: Fix potential NULL pointer dereference
@ 2019-07-08 14:39 ` Leo Yan
0 siblings, 0 replies; 22+ messages in thread
From: Leo Yan @ 2019-07-08 14:39 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
Namhyung Kim, Mathieu Poirier, Suzuki K Poulose, Adrian Hunter,
Andi Kleen, linux-kernel, linux-arm-kernel
Cc: Leo Yan
Based on the following report from Smatch, fix the potential
NULL pointer dereference check.
tools/perf/util/cs-etm.c:2545
cs_etm__process_auxtrace_info() error: we previously assumed
'session->itrace_synth_opts' could be null (see line 2541)
tools/perf/util/cs-etm.c
2541 if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
2542 etm->synth_opts = *session->itrace_synth_opts;
2543 } else {
2544 itrace_synth_opts__set_default(&etm->synth_opts,
2545 session->itrace_synth_opts->default_no_sample);
^^^^^^^^^^^^^^^^^^^^^^^^^^
2546 etm->synth_opts.callchain = false;
2547 }
'session->itrace_synth_opts' is impossible to be a NULL pointer in
cs_etm__process_auxtrace_info(), thus this patch removes the NULL
test for 'session->itrace_synth_opts'.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
tools/perf/util/cs-etm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index ad43a6e31827..ab578a06a790 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -2537,7 +2537,7 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
return 0;
}
- if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
+ if (session->itrace_synth_opts->set) {
etm->synth_opts = *session->itrace_synth_opts;
} else {
itrace_synth_opts__set_default(&etm->synth_opts,
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH v2 4/4] perf cs-etm: Smatch: Fix potential NULL pointer dereference
2019-07-08 14:39 ` Leo Yan
@ 2019-07-08 17:38 ` Mathieu Poirier
-1 siblings, 0 replies; 22+ messages in thread
From: Mathieu Poirier @ 2019-07-08 17:38 UTC (permalink / raw)
To: Leo Yan
Cc: Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
Namhyung Kim, Suzuki K Poulose, Adrian Hunter, Andi Kleen,
Linux Kernel Mailing List, linux-arm-kernel
On Mon, 8 Jul 2019 at 08:40, Leo Yan <leo.yan@linaro.org> wrote:
>
> Based on the following report from Smatch, fix the potential
> NULL pointer dereference check.
>
> tools/perf/util/cs-etm.c:2545
> cs_etm__process_auxtrace_info() error: we previously assumed
> 'session->itrace_synth_opts' could be null (see line 2541)
>
> tools/perf/util/cs-etm.c
> 2541 if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
> 2542 etm->synth_opts = *session->itrace_synth_opts;
> 2543 } else {
> 2544 itrace_synth_opts__set_default(&etm->synth_opts,
> 2545 session->itrace_synth_opts->default_no_sample);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
> 2546 etm->synth_opts.callchain = false;
> 2547 }
>
> 'session->itrace_synth_opts' is impossible to be a NULL pointer in
> cs_etm__process_auxtrace_info(), thus this patch removes the NULL
> test for 'session->itrace_synth_opts'.
>
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
> tools/perf/util/cs-etm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> index ad43a6e31827..ab578a06a790 100644
> --- a/tools/perf/util/cs-etm.c
> +++ b/tools/perf/util/cs-etm.c
> @@ -2537,7 +2537,7 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
> return 0;
> }
>
> - if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
> + if (session->itrace_synth_opts->set) {
> etm->synth_opts = *session->itrace_synth_opts;
> } else {
> itrace_synth_opts__set_default(&etm->synth_opts,
This is in accordance with what was previously discussed.
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 4/4] perf cs-etm: Smatch: Fix potential NULL pointer dereference
@ 2019-07-08 17:38 ` Mathieu Poirier
0 siblings, 0 replies; 22+ messages in thread
From: Mathieu Poirier @ 2019-07-08 17:38 UTC (permalink / raw)
To: Leo Yan
Cc: Andi Kleen, Suzuki K Poulose, Alexander Shishkin, Adrian Hunter,
Arnaldo Carvalho de Melo, Linux Kernel Mailing List,
Namhyung Kim, Jiri Olsa, linux-arm-kernel
On Mon, 8 Jul 2019 at 08:40, Leo Yan <leo.yan@linaro.org> wrote:
>
> Based on the following report from Smatch, fix the potential
> NULL pointer dereference check.
>
> tools/perf/util/cs-etm.c:2545
> cs_etm__process_auxtrace_info() error: we previously assumed
> 'session->itrace_synth_opts' could be null (see line 2541)
>
> tools/perf/util/cs-etm.c
> 2541 if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
> 2542 etm->synth_opts = *session->itrace_synth_opts;
> 2543 } else {
> 2544 itrace_synth_opts__set_default(&etm->synth_opts,
> 2545 session->itrace_synth_opts->default_no_sample);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
> 2546 etm->synth_opts.callchain = false;
> 2547 }
>
> 'session->itrace_synth_opts' is impossible to be a NULL pointer in
> cs_etm__process_auxtrace_info(), thus this patch removes the NULL
> test for 'session->itrace_synth_opts'.
>
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
> tools/perf/util/cs-etm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> index ad43a6e31827..ab578a06a790 100644
> --- a/tools/perf/util/cs-etm.c
> +++ b/tools/perf/util/cs-etm.c
> @@ -2537,7 +2537,7 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
> return 0;
> }
>
> - if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
> + if (session->itrace_synth_opts->set) {
> etm->synth_opts = *session->itrace_synth_opts;
> } else {
> itrace_synth_opts__set_default(&etm->synth_opts,
This is in accordance with what was previously discussed.
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> --
> 2.17.1
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 4/4] perf cs-etm: Smatch: Fix potential NULL pointer dereference
2019-07-08 17:38 ` Mathieu Poirier
@ 2019-07-08 21:57 ` Arnaldo Carvalho de Melo
-1 siblings, 0 replies; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-07-08 21:57 UTC (permalink / raw)
To: Mathieu Poirier
Cc: Leo Yan, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
Suzuki K Poulose, Adrian Hunter, Andi Kleen,
Linux Kernel Mailing List, linux-arm-kernel
Em Mon, Jul 08, 2019 at 11:38:48AM -0600, Mathieu Poirier escreveu:
> On Mon, 8 Jul 2019 at 08:40, Leo Yan <leo.yan@linaro.org> wrote:
> >
> > Based on the following report from Smatch, fix the potential
> > NULL pointer dereference check.
> >
> > tools/perf/util/cs-etm.c:2545
> > cs_etm__process_auxtrace_info() error: we previously assumed
> > 'session->itrace_synth_opts' could be null (see line 2541)
> >
> > tools/perf/util/cs-etm.c
> > 2541 if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
> > 2542 etm->synth_opts = *session->itrace_synth_opts;
> > 2543 } else {
> > 2544 itrace_synth_opts__set_default(&etm->synth_opts,
> > 2545 session->itrace_synth_opts->default_no_sample);
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^
> > 2546 etm->synth_opts.callchain = false;
> > 2547 }
> >
> > 'session->itrace_synth_opts' is impossible to be a NULL pointer in
> > cs_etm__process_auxtrace_info(), thus this patch removes the NULL
> > test for 'session->itrace_synth_opts'.
> >
> > Signed-off-by: Leo Yan <leo.yan@linaro.org>
> > ---
> > tools/perf/util/cs-etm.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> > index ad43a6e31827..ab578a06a790 100644
> > --- a/tools/perf/util/cs-etm.c
> > +++ b/tools/perf/util/cs-etm.c
> > @@ -2537,7 +2537,7 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
> > return 0;
> > }
> >
> > - if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
> > + if (session->itrace_synth_opts->set) {
> > etm->synth_opts = *session->itrace_synth_opts;
> > } else {
> > itrace_synth_opts__set_default(&etm->synth_opts,
>
> This is in accordance with what was previously discussed.
>
> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Thanks, applied.
- Arnaldo
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 4/4] perf cs-etm: Smatch: Fix potential NULL pointer dereference
@ 2019-07-08 21:57 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-07-08 21:57 UTC (permalink / raw)
To: Mathieu Poirier
Cc: Andi Kleen, Suzuki K Poulose, Alexander Shishkin, Adrian Hunter,
Linux Kernel Mailing List, Leo Yan, Namhyung Kim, Jiri Olsa,
linux-arm-kernel
Em Mon, Jul 08, 2019 at 11:38:48AM -0600, Mathieu Poirier escreveu:
> On Mon, 8 Jul 2019 at 08:40, Leo Yan <leo.yan@linaro.org> wrote:
> >
> > Based on the following report from Smatch, fix the potential
> > NULL pointer dereference check.
> >
> > tools/perf/util/cs-etm.c:2545
> > cs_etm__process_auxtrace_info() error: we previously assumed
> > 'session->itrace_synth_opts' could be null (see line 2541)
> >
> > tools/perf/util/cs-etm.c
> > 2541 if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
> > 2542 etm->synth_opts = *session->itrace_synth_opts;
> > 2543 } else {
> > 2544 itrace_synth_opts__set_default(&etm->synth_opts,
> > 2545 session->itrace_synth_opts->default_no_sample);
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^
> > 2546 etm->synth_opts.callchain = false;
> > 2547 }
> >
> > 'session->itrace_synth_opts' is impossible to be a NULL pointer in
> > cs_etm__process_auxtrace_info(), thus this patch removes the NULL
> > test for 'session->itrace_synth_opts'.
> >
> > Signed-off-by: Leo Yan <leo.yan@linaro.org>
> > ---
> > tools/perf/util/cs-etm.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> > index ad43a6e31827..ab578a06a790 100644
> > --- a/tools/perf/util/cs-etm.c
> > +++ b/tools/perf/util/cs-etm.c
> > @@ -2537,7 +2537,7 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
> > return 0;
> > }
> >
> > - if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
> > + if (session->itrace_synth_opts->set) {
> > etm->synth_opts = *session->itrace_synth_opts;
> > } else {
> > itrace_synth_opts__set_default(&etm->synth_opts,
>
> This is in accordance with what was previously discussed.
>
> Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Thanks, applied.
- Arnaldo
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 3/4] perf intel-pt: Smatch: Fix potential NULL pointer dereference
2019-07-08 14:39 ` Leo Yan
@ 2019-07-08 21:59 ` Arnaldo Carvalho de Melo
-1 siblings, 0 replies; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-07-08 21:59 UTC (permalink / raw)
To: Leo Yan
Cc: Alexander Shishkin, Jiri Olsa, Namhyung Kim, Mathieu Poirier,
Suzuki K Poulose, Adrian Hunter, Andi Kleen, linux-kernel,
linux-arm-kernel
Em Mon, Jul 08, 2019 at 10:39:36PM +0800, Leo Yan escreveu:
> Based on the following report from Smatch, fix the potential
> NULL pointer dereference check.
Adrian, are you ok now with these two for pt and bts? Can I have your
acked-by?
- Arnaldo
> tools/perf/util/intel-pt.c:3200
> intel_pt_process_auxtrace_info() error: we previously assumed
> 'session->itrace_synth_opts' could be null (see line 3196)
>
> tools/perf/util/intel-pt.c:3206
> intel_pt_process_auxtrace_info() warn: variable dereferenced before
> check 'session->itrace_synth_opts' (see line 3200)
>
> tools/perf/util/intel-pt.c
> 3196 if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
> 3197 pt->synth_opts = *session->itrace_synth_opts;
> 3198 } else {
> 3199 itrace_synth_opts__set_default(&pt->synth_opts,
> 3200 session->itrace_synth_opts->default_no_sample);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
> 3201 if (!session->itrace_synth_opts->default_no_sample &&
> 3202 !session->itrace_synth_opts->inject) {
> 3203 pt->synth_opts.branches = false;
> 3204 pt->synth_opts.callchain = true;
> 3205 }
> 3206 if (session->itrace_synth_opts)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
> 3207 pt->synth_opts.thread_stack =
> 3208 session->itrace_synth_opts->thread_stack;
> 3209 }
>
> 'session->itrace_synth_opts' is impossible to be a NULL pointer in
> intel_pt_process_auxtrace_info(), thus this patch removes the NULL
> test for 'session->itrace_synth_opts'.
>
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
> tools/perf/util/intel-pt.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
> index c76a96f777fb..df061599fef4 100644
> --- a/tools/perf/util/intel-pt.c
> +++ b/tools/perf/util/intel-pt.c
> @@ -3210,7 +3210,7 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
> goto err_delete_thread;
> }
>
> - if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
> + if (session->itrace_synth_opts->set) {
> pt->synth_opts = *session->itrace_synth_opts;
> } else {
> itrace_synth_opts__set_default(&pt->synth_opts,
> @@ -3220,8 +3220,7 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
> pt->synth_opts.branches = false;
> pt->synth_opts.callchain = true;
> }
> - if (session->itrace_synth_opts)
> - pt->synth_opts.thread_stack =
> + pt->synth_opts.thread_stack =
> session->itrace_synth_opts->thread_stack;
> }
>
> @@ -3241,11 +3240,9 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
> pt->cbr2khz = tsc_freq / pt->max_non_turbo_ratio / 1000;
> }
>
> - if (session->itrace_synth_opts) {
> - err = intel_pt_setup_time_ranges(pt, session->itrace_synth_opts);
> - if (err)
> - goto err_delete_thread;
> - }
> + err = intel_pt_setup_time_ranges(pt, session->itrace_synth_opts);
> + if (err)
> + goto err_delete_thread;
>
> if (pt->synth_opts.calls)
> pt->branches_filter |= PERF_IP_FLAG_CALL | PERF_IP_FLAG_ASYNC |
> --
> 2.17.1
--
- Arnaldo
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 3/4] perf intel-pt: Smatch: Fix potential NULL pointer dereference
@ 2019-07-08 21:59 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-07-08 21:59 UTC (permalink / raw)
To: Leo Yan
Cc: Andi Kleen, Mathieu Poirier, Suzuki K Poulose,
Alexander Shishkin, Adrian Hunter, linux-kernel, Namhyung Kim,
Jiri Olsa, linux-arm-kernel
Em Mon, Jul 08, 2019 at 10:39:36PM +0800, Leo Yan escreveu:
> Based on the following report from Smatch, fix the potential
> NULL pointer dereference check.
Adrian, are you ok now with these two for pt and bts? Can I have your
acked-by?
- Arnaldo
> tools/perf/util/intel-pt.c:3200
> intel_pt_process_auxtrace_info() error: we previously assumed
> 'session->itrace_synth_opts' could be null (see line 3196)
>
> tools/perf/util/intel-pt.c:3206
> intel_pt_process_auxtrace_info() warn: variable dereferenced before
> check 'session->itrace_synth_opts' (see line 3200)
>
> tools/perf/util/intel-pt.c
> 3196 if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
> 3197 pt->synth_opts = *session->itrace_synth_opts;
> 3198 } else {
> 3199 itrace_synth_opts__set_default(&pt->synth_opts,
> 3200 session->itrace_synth_opts->default_no_sample);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
> 3201 if (!session->itrace_synth_opts->default_no_sample &&
> 3202 !session->itrace_synth_opts->inject) {
> 3203 pt->synth_opts.branches = false;
> 3204 pt->synth_opts.callchain = true;
> 3205 }
> 3206 if (session->itrace_synth_opts)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
> 3207 pt->synth_opts.thread_stack =
> 3208 session->itrace_synth_opts->thread_stack;
> 3209 }
>
> 'session->itrace_synth_opts' is impossible to be a NULL pointer in
> intel_pt_process_auxtrace_info(), thus this patch removes the NULL
> test for 'session->itrace_synth_opts'.
>
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
> tools/perf/util/intel-pt.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
> index c76a96f777fb..df061599fef4 100644
> --- a/tools/perf/util/intel-pt.c
> +++ b/tools/perf/util/intel-pt.c
> @@ -3210,7 +3210,7 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
> goto err_delete_thread;
> }
>
> - if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
> + if (session->itrace_synth_opts->set) {
> pt->synth_opts = *session->itrace_synth_opts;
> } else {
> itrace_synth_opts__set_default(&pt->synth_opts,
> @@ -3220,8 +3220,7 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
> pt->synth_opts.branches = false;
> pt->synth_opts.callchain = true;
> }
> - if (session->itrace_synth_opts)
> - pt->synth_opts.thread_stack =
> + pt->synth_opts.thread_stack =
> session->itrace_synth_opts->thread_stack;
> }
>
> @@ -3241,11 +3240,9 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
> pt->cbr2khz = tsc_freq / pt->max_non_turbo_ratio / 1000;
> }
>
> - if (session->itrace_synth_opts) {
> - err = intel_pt_setup_time_ranges(pt, session->itrace_synth_opts);
> - if (err)
> - goto err_delete_thread;
> - }
> + err = intel_pt_setup_time_ranges(pt, session->itrace_synth_opts);
> + if (err)
> + goto err_delete_thread;
>
> if (pt->synth_opts.calls)
> pt->branches_filter |= PERF_IP_FLAG_CALL | PERF_IP_FLAG_ASYNC |
> --
> 2.17.1
--
- Arnaldo
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 3/4] perf intel-pt: Smatch: Fix potential NULL pointer dereference
2019-07-08 21:59 ` Arnaldo Carvalho de Melo
@ 2019-07-09 11:37 ` Adrian Hunter
-1 siblings, 0 replies; 22+ messages in thread
From: Adrian Hunter @ 2019-07-09 11:37 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Leo Yan
Cc: Alexander Shishkin, Jiri Olsa, Namhyung Kim, Mathieu Poirier,
Suzuki K Poulose, Andi Kleen, linux-kernel, linux-arm-kernel
On 9/07/19 12:59 AM, Arnaldo Carvalho de Melo wrote:
> Em Mon, Jul 08, 2019 at 10:39:36PM +0800, Leo Yan escreveu:
>> Based on the following report from Smatch, fix the potential
>> NULL pointer dereference check.
>
> Adrian, are you ok now with these two for pt and bts? Can I have your
> acked-by?
Yes they are good. For both:
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
>
> - Arnaldo
>
>> tools/perf/util/intel-pt.c:3200
>> intel_pt_process_auxtrace_info() error: we previously assumed
>> 'session->itrace_synth_opts' could be null (see line 3196)
>>
>> tools/perf/util/intel-pt.c:3206
>> intel_pt_process_auxtrace_info() warn: variable dereferenced before
>> check 'session->itrace_synth_opts' (see line 3200)
>>
>> tools/perf/util/intel-pt.c
>> 3196 if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
>> 3197 pt->synth_opts = *session->itrace_synth_opts;
>> 3198 } else {
>> 3199 itrace_synth_opts__set_default(&pt->synth_opts,
>> 3200 session->itrace_synth_opts->default_no_sample);
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^
>> 3201 if (!session->itrace_synth_opts->default_no_sample &&
>> 3202 !session->itrace_synth_opts->inject) {
>> 3203 pt->synth_opts.branches = false;
>> 3204 pt->synth_opts.callchain = true;
>> 3205 }
>> 3206 if (session->itrace_synth_opts)
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^
>> 3207 pt->synth_opts.thread_stack =
>> 3208 session->itrace_synth_opts->thread_stack;
>> 3209 }
>>
>> 'session->itrace_synth_opts' is impossible to be a NULL pointer in
>> intel_pt_process_auxtrace_info(), thus this patch removes the NULL
>> test for 'session->itrace_synth_opts'.
>>
>> Signed-off-by: Leo Yan <leo.yan@linaro.org>
>> ---
>> tools/perf/util/intel-pt.c | 13 +++++--------
>> 1 file changed, 5 insertions(+), 8 deletions(-)
>>
>> diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
>> index c76a96f777fb..df061599fef4 100644
>> --- a/tools/perf/util/intel-pt.c
>> +++ b/tools/perf/util/intel-pt.c
>> @@ -3210,7 +3210,7 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
>> goto err_delete_thread;
>> }
>>
>> - if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
>> + if (session->itrace_synth_opts->set) {
>> pt->synth_opts = *session->itrace_synth_opts;
>> } else {
>> itrace_synth_opts__set_default(&pt->synth_opts,
>> @@ -3220,8 +3220,7 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
>> pt->synth_opts.branches = false;
>> pt->synth_opts.callchain = true;
>> }
>> - if (session->itrace_synth_opts)
>> - pt->synth_opts.thread_stack =
>> + pt->synth_opts.thread_stack =
>> session->itrace_synth_opts->thread_stack;
>> }
>>
>> @@ -3241,11 +3240,9 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
>> pt->cbr2khz = tsc_freq / pt->max_non_turbo_ratio / 1000;
>> }
>>
>> - if (session->itrace_synth_opts) {
>> - err = intel_pt_setup_time_ranges(pt, session->itrace_synth_opts);
>> - if (err)
>> - goto err_delete_thread;
>> - }
>> + err = intel_pt_setup_time_ranges(pt, session->itrace_synth_opts);
>> + if (err)
>> + goto err_delete_thread;
>>
>> if (pt->synth_opts.calls)
>> pt->branches_filter |= PERF_IP_FLAG_CALL | PERF_IP_FLAG_ASYNC |
>> --
>> 2.17.1
>
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 3/4] perf intel-pt: Smatch: Fix potential NULL pointer dereference
@ 2019-07-09 11:37 ` Adrian Hunter
0 siblings, 0 replies; 22+ messages in thread
From: Adrian Hunter @ 2019-07-09 11:37 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Leo Yan
Cc: Andi Kleen, Mathieu Poirier, Suzuki K Poulose,
Alexander Shishkin, linux-kernel, Namhyung Kim, Jiri Olsa,
linux-arm-kernel
On 9/07/19 12:59 AM, Arnaldo Carvalho de Melo wrote:
> Em Mon, Jul 08, 2019 at 10:39:36PM +0800, Leo Yan escreveu:
>> Based on the following report from Smatch, fix the potential
>> NULL pointer dereference check.
>
> Adrian, are you ok now with these two for pt and bts? Can I have your
> acked-by?
Yes they are good. For both:
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
>
> - Arnaldo
>
>> tools/perf/util/intel-pt.c:3200
>> intel_pt_process_auxtrace_info() error: we previously assumed
>> 'session->itrace_synth_opts' could be null (see line 3196)
>>
>> tools/perf/util/intel-pt.c:3206
>> intel_pt_process_auxtrace_info() warn: variable dereferenced before
>> check 'session->itrace_synth_opts' (see line 3200)
>>
>> tools/perf/util/intel-pt.c
>> 3196 if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
>> 3197 pt->synth_opts = *session->itrace_synth_opts;
>> 3198 } else {
>> 3199 itrace_synth_opts__set_default(&pt->synth_opts,
>> 3200 session->itrace_synth_opts->default_no_sample);
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^
>> 3201 if (!session->itrace_synth_opts->default_no_sample &&
>> 3202 !session->itrace_synth_opts->inject) {
>> 3203 pt->synth_opts.branches = false;
>> 3204 pt->synth_opts.callchain = true;
>> 3205 }
>> 3206 if (session->itrace_synth_opts)
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^
>> 3207 pt->synth_opts.thread_stack =
>> 3208 session->itrace_synth_opts->thread_stack;
>> 3209 }
>>
>> 'session->itrace_synth_opts' is impossible to be a NULL pointer in
>> intel_pt_process_auxtrace_info(), thus this patch removes the NULL
>> test for 'session->itrace_synth_opts'.
>>
>> Signed-off-by: Leo Yan <leo.yan@linaro.org>
>> ---
>> tools/perf/util/intel-pt.c | 13 +++++--------
>> 1 file changed, 5 insertions(+), 8 deletions(-)
>>
>> diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
>> index c76a96f777fb..df061599fef4 100644
>> --- a/tools/perf/util/intel-pt.c
>> +++ b/tools/perf/util/intel-pt.c
>> @@ -3210,7 +3210,7 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
>> goto err_delete_thread;
>> }
>>
>> - if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
>> + if (session->itrace_synth_opts->set) {
>> pt->synth_opts = *session->itrace_synth_opts;
>> } else {
>> itrace_synth_opts__set_default(&pt->synth_opts,
>> @@ -3220,8 +3220,7 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
>> pt->synth_opts.branches = false;
>> pt->synth_opts.callchain = true;
>> }
>> - if (session->itrace_synth_opts)
>> - pt->synth_opts.thread_stack =
>> + pt->synth_opts.thread_stack =
>> session->itrace_synth_opts->thread_stack;
>> }
>>
>> @@ -3241,11 +3240,9 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
>> pt->cbr2khz = tsc_freq / pt->max_non_turbo_ratio / 1000;
>> }
>>
>> - if (session->itrace_synth_opts) {
>> - err = intel_pt_setup_time_ranges(pt, session->itrace_synth_opts);
>> - if (err)
>> - goto err_delete_thread;
>> - }
>> + err = intel_pt_setup_time_ranges(pt, session->itrace_synth_opts);
>> + if (err)
>> + goto err_delete_thread;
>>
>> if (pt->synth_opts.calls)
>> pt->branches_filter |= PERF_IP_FLAG_CALL | PERF_IP_FLAG_ASYNC |
>> --
>> 2.17.1
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 22+ messages in thread
* [tip:perf/urgent] perf cs-etm: Fix potential NULL pointer dereference found by the smatch tool
2019-07-08 14:39 ` Leo Yan
(?)
(?)
@ 2019-07-13 11:05 ` tip-bot for Leo Yan
-1 siblings, 0 replies; 22+ messages in thread
From: tip-bot for Leo Yan @ 2019-07-13 11:05 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, suzuki.poulose, hpa, jolsa, ak, acme,
adrian.hunter, mingo, mathieu.poirier, alexander.shishkin,
leo.yan, tglx, namhyung
Commit-ID: 0702f23c983b8a921853c33a9f59b9cf0975d36e
Gitweb: https://git.kernel.org/tip/0702f23c983b8a921853c33a9f59b9cf0975d36e
Author: Leo Yan <leo.yan@linaro.org>
AuthorDate: Mon, 8 Jul 2019 22:39:37 +0800
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 9 Jul 2019 10:13:27 -0300
perf cs-etm: 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/util/cs-etm.c:2545
cs_etm__process_auxtrace_info() error: we previously assumed
'session->itrace_synth_opts' could be null (see line 2541)
tools/perf/util/cs-etm.c
2541 if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
2542 etm->synth_opts = *session->itrace_synth_opts;
2543 } else {
2544 itrace_synth_opts__set_default(&etm->synth_opts,
2545 session->itrace_synth_opts->default_no_sample);
^^^^^^^^^^^^^^^^^^^^^^^^^^
2546 etm->synth_opts.callchain = false;
2547 }
'session->itrace_synth_opts' is impossible to be a NULL pointer in
cs_etm__process_auxtrace_info(), thus this patch removes the NULL
test for 'session->itrace_synth_opts'.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/20190708143937.7722-5-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/cs-etm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index 508e4a3ddc8c..67b88b599a53 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -2538,7 +2538,7 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
return 0;
}
- if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
+ if (session->itrace_synth_opts->set) {
etm->synth_opts = *session->itrace_synth_opts;
} else {
itrace_synth_opts__set_default(&etm->synth_opts,
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip:perf/urgent] perf hists browser: Fix potential NULL pointer dereference found by the smatch tool
2019-07-08 14:39 ` Leo Yan
(?)
@ 2019-07-13 11:05 ` tip-bot for Leo Yan
-1 siblings, 0 replies; 22+ messages in thread
From: tip-bot for Leo Yan @ 2019-07-13 11:05 UTC (permalink / raw)
To: linux-tip-commits
Cc: ak, adrian.hunter, mingo, hpa, suzuki.poulose, tglx, leo.yan,
linux-kernel, mathieu.poirier, jolsa, namhyung, acme,
alexander.shishkin
Commit-ID: ceb75476db1617a88cc29b09839acacb69aa076e
Gitweb: https://git.kernel.org/tip/ceb75476db1617a88cc29b09839acacb69aa076e
Author: Leo Yan <leo.yan@linaro.org>
AuthorDate: Mon, 8 Jul 2019 22:39:34 +0800
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 9 Jul 2019 10:13:27 -0300
perf hists browser: 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/ui/browsers/hists.c:641
hist_browser__run() error: we previously assumed 'hbt' could be
null (see line 625)
tools/perf/ui/browsers/hists.c:3088
perf_evsel__hists_browse() error: we previously assumed
'browser->he_selection' could be null (see line 2902)
tools/perf/ui/browsers/hists.c:3272
perf_evsel_menu__run() error: we previously assumed 'hbt' could be
null (see line 3260)
This patch firstly validating the pointers before access them, so can
fix potential NULL pointer dereference.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/20190708143937.7722-2-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/browsers/hists.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 85581cfb9112..a94eb0755e8b 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -639,7 +639,11 @@ int hist_browser__run(struct hist_browser *browser, const char *help,
switch (key) {
case K_TIMER: {
u64 nr_entries;
- hbt->timer(hbt->arg);
+
+ WARN_ON_ONCE(!hbt);
+
+ if (hbt)
+ hbt->timer(hbt->arg);
if (hist_browser__has_filter(browser) ||
symbol_conf.report_hierarchy)
@@ -2821,7 +2825,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
{
struct hists *hists = evsel__hists(evsel);
struct hist_browser *browser = perf_evsel_browser__new(evsel, hbt, env, annotation_opts);
- struct branch_info *bi;
+ struct branch_info *bi = NULL;
#define MAX_OPTIONS 16
char *options[MAX_OPTIONS];
struct popup_action actions[MAX_OPTIONS];
@@ -3087,7 +3091,9 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
goto skip_annotation;
if (sort__mode == SORT_MODE__BRANCH) {
- bi = browser->he_selection->branch_info;
+
+ if (browser->he_selection)
+ bi = browser->he_selection->branch_info;
if (bi == NULL)
goto skip_annotation;
@@ -3271,7 +3277,8 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu,
switch (key) {
case K_TIMER:
- hbt->timer(hbt->arg);
+ if (hbt)
+ hbt->timer(hbt->arg);
if (!menu->lost_events_warned &&
menu->lost_events &&
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip:perf/urgent] perf intel-bts: Fix potential NULL pointer dereference found by the smatch tool
2019-07-08 14:39 ` Leo Yan
(?)
@ 2019-07-13 11:08 ` tip-bot for Leo Yan
-1 siblings, 0 replies; 22+ messages in thread
From: tip-bot for Leo Yan @ 2019-07-13 11:08 UTC (permalink / raw)
To: linux-tip-commits
Cc: tglx, mingo, alexander.shishkin, jolsa, namhyung, leo.yan, ak,
linux-kernel, mathieu.poirier, acme, suzuki.poulose, hpa,
adrian.hunter
Commit-ID: 1d481458816d9424c8a05833ce0ebe72194a350e
Gitweb: https://git.kernel.org/tip/1d481458816d9424c8a05833ce0ebe72194a350e
Author: Leo Yan <leo.yan@linaro.org>
AuthorDate: Mon, 8 Jul 2019 22:39:35 +0800
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 9 Jul 2019 10:13:28 -0300
perf intel-bts: 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/util/intel-bts.c:898
intel_bts_process_auxtrace_info() error: we previously assumed
'session->itrace_synth_opts' could be null (see line 894)
tools/perf/util/intel-bts.c:899
intel_bts_process_auxtrace_info() warn: variable dereferenced before
check 'session->itrace_synth_opts' (see line 898)
tools/perf/util/intel-bts.c
894 if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
895 bts->synth_opts = *session->itrace_synth_opts;
896 } else {
897 itrace_synth_opts__set_default(&bts->synth_opts,
898 session->itrace_synth_opts->default_no_sample);
^^^^^^^^^^^^^^^^^^^^^^^^^^
899 if (session->itrace_synth_opts)
^^^^^^^^^^^^^^^^^^^^^^^^^^
900 bts->synth_opts.thread_stack =
901 session->itrace_synth_opts->thread_stack;
902 }
'session->itrace_synth_opts' is impossible to be a NULL pointer in
intel_bts_process_auxtrace_info(), thus this patch removes the NULL test
for 'session->itrace_synth_opts'.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/20190708143937.7722-3-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/intel-bts.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c
index 5a21bcdb8ef7..5560e95afdda 100644
--- a/tools/perf/util/intel-bts.c
+++ b/tools/perf/util/intel-bts.c
@@ -891,13 +891,12 @@ int intel_bts_process_auxtrace_info(union perf_event *event,
if (dump_trace)
return 0;
- if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
+ if (session->itrace_synth_opts->set) {
bts->synth_opts = *session->itrace_synth_opts;
} else {
itrace_synth_opts__set_default(&bts->synth_opts,
session->itrace_synth_opts->default_no_sample);
- if (session->itrace_synth_opts)
- bts->synth_opts.thread_stack =
+ bts->synth_opts.thread_stack =
session->itrace_synth_opts->thread_stack;
}
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [tip:perf/urgent] perf intel-pt: Fix potential NULL pointer dereference found by the smatch tool
2019-07-08 14:39 ` Leo Yan
(?)
(?)
@ 2019-07-13 11:09 ` tip-bot for Leo Yan
-1 siblings, 0 replies; 22+ messages in thread
From: tip-bot for Leo Yan @ 2019-07-13 11:09 UTC (permalink / raw)
To: linux-tip-commits
Cc: jolsa, suzuki.poulose, namhyung, leo.yan, hpa, tglx,
mathieu.poirier, mingo, acme, alexander.shishkin, adrian.hunter,
ak, linux-kernel
Commit-ID: 323fd749821daab0f327ec86d707c4542963cdb0
Gitweb: https://git.kernel.org/tip/323fd749821daab0f327ec86d707c4542963cdb0
Author: Leo Yan <leo.yan@linaro.org>
AuthorDate: Mon, 8 Jul 2019 22:39:36 +0800
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 9 Jul 2019 10:13:28 -0300
perf intel-pt: 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/util/intel-pt.c:3200
intel_pt_process_auxtrace_info() error: we previously assumed
'session->itrace_synth_opts' could be null (see line 3196)
tools/perf/util/intel-pt.c:3206
intel_pt_process_auxtrace_info() warn: variable dereferenced before
check 'session->itrace_synth_opts' (see line 3200)
tools/perf/util/intel-pt.c
3196 if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
3197 pt->synth_opts = *session->itrace_synth_opts;
3198 } else {
3199 itrace_synth_opts__set_default(&pt->synth_opts,
3200 session->itrace_synth_opts->default_no_sample);
^^^^^^^^^^^^^^^^^^^^^^^^^^
3201 if (!session->itrace_synth_opts->default_no_sample &&
3202 !session->itrace_synth_opts->inject) {
3203 pt->synth_opts.branches = false;
3204 pt->synth_opts.callchain = true;
3205 }
3206 if (session->itrace_synth_opts)
^^^^^^^^^^^^^^^^^^^^^^^^^^
3207 pt->synth_opts.thread_stack =
3208 session->itrace_synth_opts->thread_stack;
3209 }
'session->itrace_synth_opts' is impossible to be a NULL pointer in
intel_pt_process_auxtrace_info(), thus this patch removes the NULL test
for 'session->itrace_synth_opts'.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/20190708143937.7722-4-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/intel-pt.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
index c76a96f777fb..df061599fef4 100644
--- a/tools/perf/util/intel-pt.c
+++ b/tools/perf/util/intel-pt.c
@@ -3210,7 +3210,7 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
goto err_delete_thread;
}
- if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
+ if (session->itrace_synth_opts->set) {
pt->synth_opts = *session->itrace_synth_opts;
} else {
itrace_synth_opts__set_default(&pt->synth_opts,
@@ -3220,8 +3220,7 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
pt->synth_opts.branches = false;
pt->synth_opts.callchain = true;
}
- if (session->itrace_synth_opts)
- pt->synth_opts.thread_stack =
+ pt->synth_opts.thread_stack =
session->itrace_synth_opts->thread_stack;
}
@@ -3241,11 +3240,9 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
pt->cbr2khz = tsc_freq / pt->max_non_turbo_ratio / 1000;
}
- if (session->itrace_synth_opts) {
- err = intel_pt_setup_time_ranges(pt, session->itrace_synth_opts);
- if (err)
- goto err_delete_thread;
- }
+ err = intel_pt_setup_time_ranges(pt, session->itrace_synth_opts);
+ if (err)
+ goto err_delete_thread;
if (pt->synth_opts.calls)
pt->branches_filter |= PERF_IP_FLAG_CALL | PERF_IP_FLAG_ASYNC |
^ permalink raw reply related [flat|nested] 22+ messages in thread
end of thread, other threads:[~2019-07-13 11:10 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-08 14:39 [PATCH v2 0/4] perf: Fix errors detected by Smatch Leo Yan
2019-07-08 14:39 ` Leo Yan
2019-07-08 14:39 ` [PATCH v2 1/4] perf hists: Smatch: Fix potential NULL pointer dereference Leo Yan
2019-07-08 14:39 ` Leo Yan
2019-07-13 11:05 ` [tip:perf/urgent] perf hists browser: Fix potential NULL pointer dereference found by the smatch tool tip-bot for Leo Yan
2019-07-08 14:39 ` [PATCH v2 2/4] perf intel-bts: Smatch: Fix potential NULL pointer dereference Leo Yan
2019-07-08 14:39 ` Leo Yan
2019-07-13 11:08 ` [tip:perf/urgent] perf intel-bts: Fix potential NULL pointer dereference found by the smatch tool tip-bot for Leo Yan
2019-07-08 14:39 ` [PATCH v2 3/4] perf intel-pt: Smatch: Fix potential NULL pointer dereference Leo Yan
2019-07-08 14:39 ` Leo Yan
2019-07-08 21:59 ` Arnaldo Carvalho de Melo
2019-07-08 21:59 ` Arnaldo Carvalho de Melo
2019-07-09 11:37 ` Adrian Hunter
2019-07-09 11:37 ` Adrian Hunter
2019-07-13 11:09 ` [tip:perf/urgent] perf intel-pt: Fix potential NULL pointer dereference found by the smatch tool tip-bot for Leo Yan
2019-07-08 14:39 ` [PATCH v2 4/4] perf cs-etm: Smatch: Fix potential NULL pointer dereference Leo Yan
2019-07-08 14:39 ` Leo Yan
2019-07-08 17:38 ` Mathieu Poirier
2019-07-08 17:38 ` Mathieu Poirier
2019-07-08 21:57 ` Arnaldo Carvalho de Melo
2019-07-08 21:57 ` Arnaldo Carvalho de Melo
2019-07-13 11:05 ` [tip:perf/urgent] perf cs-etm: Fix potential NULL pointer dereference found by the smatch tool tip-bot for Leo Yan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.