Re: [PATCH] btrfs: fix uninitialized variable warning

From: genjian zhang
Date: Sun Apr 23 2023 - 05:24:54 EST


On Fri, Apr 7, 2023 at 3:12 AM David Sterba <dsterba@xxxxxxx> wrote:
>
> On Fri, Mar 24, 2023 at 10:08:38AM +0800, Genjian wrote:
> > From: Genjian Zhang <zhanggenjian@xxxxxxxxxx>
> >
> > compiler warning:
> >
> > ../fs/btrfs/volumes.c: In function ‘btrfs_init_new_device’:
> > ../fs/btrfs/volumes.c:2703:3: error: ‘seed_devices’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > 2703 | btrfs_setup_sprout(fs_info, seed_devices);
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > ../fs/btrfs/send.c: In function ‘get_cur_inode_state’:
> > ../include/linux/compiler.h:70:32: error: ‘right_gen’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > 70 | (__if_trace.miss_hit[1]++,1) : \
> > | ^
> > ../fs/btrfs/send.c:1878:6: note: ‘right_gen’ was declared here
> > 1878 | u64 right_gen;
> > | ^~~~~~~~~
> >
> > Initialize the uninitialized variables.
> >
> > Reported-by: k2ci <kernel-bot@xxxxxxxxxx>
> > Signed-off-by: Genjian Zhang <zhanggenjian@xxxxxxxxxx>
>
> The warnings are still reported by other build reports so I'll apply
> this patch. If you have found more please send a patch or I can update
> this one once applied. Thanks.

Sorry for the late reply.
At present, only this one has been found.
Thanks.