Re: [PATCH 1/6] fs: befs: remove unneeded initialization to zero

Luis de Bethencourt
2016-08-01T12:52:49Z

On 31/07/16 21:34, Salah Triki wrote:
> off is reinitialized by befs_read_datastream, so no need to init it with
> zero in the beginning of befs_bt_read_node.
>
> Signed-off-by: Salah Triki <salah.triki@gmail.com>
> ---
> fs/befs/btree.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/befs/btree.c b/fs/befs/btree.c
> index e59ad20..a0e8cfa 100644
> --- a/fs/befs/btree.c
> +++ b/fs/befs/btree.c
> @@ -196,7 +196,7 @@ static int
> befs_bt_read_node(struct super_block *sb, const befs_data_stream *ds,
> struct befs_btree_node *node, befs_off_t node_off)
> {
> - uint off = 0;
> + uint off;
>
> befs_debug(sb, "---> %s", __func__);
>
>

Hi Salah,

I will quote Andrew here:
"With this code:

int foo;

bar(&foo);

whatever = foo;

some versions of gcc will warn that foo might be used uninitialized.
Other versions of gcc don't do this. That's why the seemingly-unneeded
initializations are there."

You can read the rest of his reply to when I sent the same change 2
months ago :)

https://lkml.org/lkml/2016/6/1/875

Sorry, I agree with him to keep the code as it is.

Nacked.

Thanks,
Luis