LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Hongbo Yao <yaohongbo@huawei.com>
Cc: alexander.shishkin@linux.intel.com, mark.rutland@arm.com,
	jolsa@redhat.com, namhyung@kernel.org, liwei391@huawei.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] perf util: Fix null pointer dereference
Date: Mon, 8 Jun 2020 13:36:25 -0300
Message-ID: <20200608163625.GC3073@kernel.org> (raw)
In-Reply-To: <20200605091740.40206-1-yaohongbo@huawei.com>

Em Fri, Jun 05, 2020 at 05:17:40PM +0800, Hongbo Yao escreveu:
> If config->aggr_map is Null and config->aggr_get_id is not Null,
> the function print_aggr() will still calling arrg_update_shadow(),
> which can result in accessing the invalid pointer.

Looks legit, but you forgot to add this:

Cc: Jiri Olsa <jolsa@kernel.org>
Fixes: 088519f318be ("perf stat: Move the display functions to stat-display.c")

That is not completely correct as this is just moving pre-existing code
(and bugs) to a different place, but at least the stable guys will get
this fix back to a good number of kernels.

Also you forgot to CC lkml,

Thanks, applied.

- Arnaldo
 
> Signed-off-by: Hongbo Yao <yaohongbo@huawei.com>
> ---
>  tools/perf/util/stat-display.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
> index 3c6976f7574c..57d0706e1330 100644
> --- a/tools/perf/util/stat-display.c
> +++ b/tools/perf/util/stat-display.c
> @@ -668,7 +668,7 @@ static void print_aggr(struct perf_stat_config *config,
>  	int s;
>  	bool first;
>  
> -	if (!(config->aggr_map || config->aggr_get_id))
> +	if (!config->aggr_map || !config->aggr_get_id)
>  		return;
>  
>  	aggr_update_shadow(config, evlist);
> @@ -1169,7 +1169,7 @@ static void print_percore(struct perf_stat_config *config,
>  	int s;
>  	bool first = true;
>  
> -	if (!(config->aggr_map || config->aggr_get_id))
> +	if (!config->aggr_map || !config->aggr_get_id)
>  		return;
>  
>  	if (config->percore_show_thread)
> -- 
> 2.20.1
> 

-- 

- Arnaldo

           reply index

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20200605091740.40206-1-yaohongbo@huawei.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200608163625.GC3073@kernel.org \
    --to=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liwei391@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=namhyung@kernel.org \
    --cc=yaohongbo@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git