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, 26 Oct 2022 14:25:21 +0000
From:   Liam Howlett <liam.howlett@...cle.com>
To:     Lukas Bulwahn <lukas.bulwahn@...il.com>
CC:     Matthew Wilcox <willy@...radead.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/1] lib: maple_tree: remove unneeded initialization in
 mtree_range_walk()


Reviewed-by: Liam R. Howlett <Liam.Howlett@...cle.com>

* Lukas Bulwahn <lukas.bulwahn@...il.com> [221026 08:01]:
> Before the do-while loop in mtree_range_walk(), the variables next, min,
> max need to be initialized. The variables last, prev_min and prev_max are
> set within the loop body before they are eventually used after exiting the
> loop body.
> 
> As it is a do-while loop, the loop body is executed at least once, so the
> variables last, prev_min and prev_max do not need to be initialized before
> the loop body.
> 
> Remove unneeded initialization of last and prev_min.
> 
> The needless initialization was reported by clang-analyzer as Dead Stores.
> 
> As the compiler already identifies these assignments as unneeded, it
> optimizes the assignments away. Hence:
> 
> No functional change. No change in object code.
> 
> Signed-off-by: Lukas Bulwahn <lukas.bulwahn@...il.com>
> ---
>  lib/maple_tree.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index e1743803c851..fbde494444b8 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -2903,8 +2903,8 @@ static inline void *mtree_range_walk(struct ma_state *mas)
>  	unsigned long max, min;
>  	unsigned long prev_max, prev_min;
>  
> -	last = next = mas->node;
> -	prev_min = min = mas->min;
> +	next = mas->node;
> +	min = mas->min;
>  	max = mas->max;
>  	do {
>  		offset = 0;
> -- 
> 2.17.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ