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] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 16 Feb 2022 10:38:43 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     tangmeng <tangmeng@...ontech.com>
Cc:     peterz@...radead.org, mingo@...hat.com, mark.rutland@....com,
        alexander.shishkin@...ux.intel.com, jolsa@...hat.com,
        namhyung@...nel.org, linux-perf-users@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] perf tools: Remove redundant err variable

Em Wed, Feb 16, 2022 at 11:04:25AM +0800, tangmeng escreveu:
> The variable err in the perf_event__process_sample is only used
> in the only one judgment statement, it is not used in other places.
> 
> So, use the return value from hist_entry_iter__add() directly
> instead of taking this in another redundant variable.

Thanks, applied.

- Arnaldo

 
> Signed-off-by: tangmeng <tangmeng@...ontech.com>
> ---
>  tools/perf/builtin-top.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
> index 1fc390f136dd..3c8c60b7f6f0 100644
> --- a/tools/perf/builtin-top.c
> +++ b/tools/perf/builtin-top.c
> @@ -746,7 +746,6 @@ static void perf_event__process_sample(struct perf_tool *tool,
>  {
>  	struct perf_top *top = container_of(tool, struct perf_top, tool);
>  	struct addr_location al;
> -	int err;
>  
>  	if (!machine && perf_guest) {
>  		static struct intlist *seen;
> @@ -839,8 +838,7 @@ static void perf_event__process_sample(struct perf_tool *tool,
>  
>  		pthread_mutex_lock(&hists->lock);
>  
> -		err = hist_entry_iter__add(&iter, &al, top->max_stack, top);
> -		if (err < 0)
> +		if (hist_entry_iter__add(&iter, &al, top->max_stack, top) < 0)
>  			pr_err("Problem incrementing symbol period, skipping event\n");
>  
>  		pthread_mutex_unlock(&hists->lock);
> -- 
> 2.20.1
> 
> 

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ