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:   Sat, 11 Nov 2023 21:19:40 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Kent Overstreet' <kent.overstreet@...ux.dev>,
        Colin Ian King <colin.i.king@...il.com>
CC:     Brian Foster <bfoster@...hat.com>,
        "linux-bcachefs@...r.kernel.org" <linux-bcachefs@...r.kernel.org>,
        "kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH][next] bcachefs: remove redundant initialization of
 variable level

From: Kent Overstreet <kent.overstreet@...ux.dev>
> Sent: 11 November 2023 21:02
> > Variable level is being initialized a value that is never read, the
> > variable is being re-assigned another value several statements later
> > on. The initialization is redundant and can be removed. Cleans up
> > clang scan build warning:
> >
> > fs/bcachefs/btree_iter.c:1217:11: warning: Value stored to 'level'
> > during its initialization is never read [deadcode.DeadStores]
> >
> > Signed-off-by: Colin Ian King <colin.i.king@...il.com>
> 
> since we're no longer gnu89, we can simply declare the variable when
> it's first used, like so:

ugg... I think that is still frowned upon.
It makes it very difficult for the average human to find
the variable declaration.

	David

> 
> diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
> index 96bdf0c6051c..104172f6822b 100644
> --- a/fs/bcachefs/btree_iter.c
> +++ b/fs/bcachefs/btree_iter.c
> @@ -1214,8 +1214,6 @@ __bch2_btree_path_set_pos(struct btree_trans *trans,
>  		   struct btree_path *path, struct bpos new_pos,
>  		   bool intent, unsigned long ip, int cmp)
>  {
> -	unsigned level = path->level;
> -
>  	bch2_trans_verify_not_in_restart(trans);
>  	EBUG_ON(!path->ref);
> 
> @@ -1231,7 +1229,7 @@ __bch2_btree_path_set_pos(struct btree_trans *trans,
>  		goto out;
>  	}
> 
> -	level = btree_path_up_until_good_node(trans, path, cmp);
> +	unsigned level = btree_path_up_until_good_node(trans, path, cmp);
> 
>  	if (btree_path_node(path, level)) {
>  		struct btree_path_level *l = &path->l[level];

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists