linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/4] perf intel-pt/bts: fix potential NULL pointer dereference in intel_bts_process_auxtrace_info
@ 2018-11-21  7:43 Wen Yang
  2018-11-21  9:13 ` Adrian Hunter
  0 siblings, 1 reply; 2+ messages in thread
From: Wen Yang @ 2018-11-21  7:43 UTC (permalink / raw)
  To: peterz
  Cc: mingo, acme, alexander.shishkin, jolsa, namhyung, adrian.hunter,
	ak, linux-kernel, zhong.weidong, wang.yi59, Wen Yang,
	Julia Lawall

This patch fixes a possible null pointer dereference in
intel_bts_process_auxtrace_info, detected by the semantic patch
deref_null.cocci, with the following warning:

./tools/perf/util/intel-bts.c:921:32-49: ERROR: session -> itrace_synth_opts is NULL but dereferenced.

Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Reviewed-by: Tan Hu <tan.hu@zte.com.cn>
CC: Julia Lawall <julia.lawall@lip6.fr>
---
 tools/perf/util/intel-bts.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c
index 7b27d77..b0258f4 100644
--- a/tools/perf/util/intel-bts.c
+++ b/tools/perf/util/intel-bts.c
@@ -917,7 +917,8 @@ int intel_bts_process_auxtrace_info(union perf_event *event,
 	if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
 		bts->synth_opts = *session->itrace_synth_opts;
 	} else {
-		itrace_synth_opts__set_default(&bts->synth_opts,
+		if (session->itrace_synth_opts)
+			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 =
-- 
2.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 4/4] perf intel-pt/bts: fix potential NULL pointer dereference in intel_bts_process_auxtrace_info
  2018-11-21  7:43 [PATCH 4/4] perf intel-pt/bts: fix potential NULL pointer dereference in intel_bts_process_auxtrace_info Wen Yang
@ 2018-11-21  9:13 ` Adrian Hunter
  0 siblings, 0 replies; 2+ messages in thread
From: Adrian Hunter @ 2018-11-21  9:13 UTC (permalink / raw)
  To: Wen Yang, peterz
  Cc: mingo, acme, alexander.shishkin, jolsa, namhyung, ak,
	linux-kernel, zhong.weidong, wang.yi59, Julia Lawall

On 21/11/18 9:43 AM, Wen Yang wrote:
> This patch fixes a possible null pointer dereference in
> intel_bts_process_auxtrace_info, detected by the semantic patch
> deref_null.cocci, with the following warning:
> 
> ./tools/perf/util/intel-bts.c:921:32-49: ERROR: session -> itrace_synth_opts is NULL but dereferenced.
> 
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> Reviewed-by: Tan Hu <tan.hu@zte.com.cn>
> CC: Julia Lawall <julia.lawall@lip6.fr>
> ---
>  tools/perf/util/intel-bts.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c
> index 7b27d77..b0258f4 100644
> --- a/tools/perf/util/intel-bts.c
> +++ b/tools/perf/util/intel-bts.c
> @@ -917,7 +917,8 @@ int intel_bts_process_auxtrace_info(union perf_event *event,
>  	if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
>  		bts->synth_opts = *session->itrace_synth_opts;
>  	} else {
> -		itrace_synth_opts__set_default(&bts->synth_opts,
> +		if (session->itrace_synth_opts)
> +			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 =
> 

See response to patch 1.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-11-21  9:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-21  7:43 [PATCH 4/4] perf intel-pt/bts: fix potential NULL pointer dereference in intel_bts_process_auxtrace_info Wen Yang
2018-11-21  9:13 ` Adrian Hunter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).