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>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20181014140446.GA24104@krava>
Date:   Sun, 14 Oct 2018 16:04:46 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     Dan Carpenter <dan.carpenter@...cle.com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Namhyung Kim <namhyung@...nel.org>,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] perf stat: Potential NULL dereference in print_aggr()

On Sat, Oct 13, 2018 at 01:19:40PM +0300, Dan Carpenter wrote:
> Smatch complains that:
> 
>     ./tools/perf/util/stat-display.c:616 print_aggr()
>     error: we previously assumed 'config->aggr_map' could be null (see line 607)
> 
> Not only that, but it looks like aggr_update_shadow() can Oops if
> "config->aggr_get_id" is NULL.  The intent seems to have been to return
> if either of these pointers is NULL.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>

Fixes: 86ee6e18f6cb ("perf stat: Refactor aggregation code")

Acked-by: Jiri Olsa <jolsa@...nel.org>

thanks,
jirka

> ---
>  tools/perf/util/stat-display.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
> index e7b4c44ebb62..db635c01d3a3 100644
> --- a/tools/perf/util/stat-display.c
> +++ b/tools/perf/util/stat-display.c
> @@ -604,7 +604,7 @@ static void print_aggr(struct perf_stat_config *config,
>  	u64 ena, run, val;
>  	bool first;
>  
> -	if (!(config->aggr_map || config->aggr_get_id))
> +	if (!config->aggr_map || !config->aggr_get_id)
>  		return;
>  
>  	aggr_update_shadow(config, evlist);
> -- 
> 2.18.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ