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:   Fri, 24 Mar 2023 11:05:57 +0800
From:   genjian zhang <zhanggenjian123@...il.com>
To:     dsterba@...e.cz
Cc:     Qu Wenruo <quwenruo.btrfs@....com>, clm@...com,
        josef@...icpanda.com, dsterba@...e.com,
        linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org,
        Genjian Zhang <zhanggenjian@...inos.cn>,
        k2ci <kernel-bot@...inos.cn>
Subject: Re: [PATCH] btrfs: fix uninitialized variable warning

On Fri, Mar 24, 2023 at 10:35 AM David Sterba <dsterba@...e.cz> wrote:
>
> On Fri, Mar 24, 2023 at 10:24:55AM +0800, Qu Wenruo wrote:
> > On 2023/3/24 10:08, Genjian wrote:
> > > From: Genjian Zhang <zhanggenjian@...inos.cn>
> > >
> > > compiler warning:
> >
> > Compiler version please.
> >
> > >
> > > ../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@...inos.cn>
> > > Signed-off-by: Genjian Zhang <zhanggenjian@...inos.cn>
> > > ---
> > >   fs/btrfs/send.c    | 2 +-
> > >   fs/btrfs/volumes.c | 2 +-
> > >   2 files changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
> > > index e5c963bb873d..af2e153543a5 100644
> > > --- a/fs/btrfs/send.c
> > > +++ b/fs/btrfs/send.c
> > > @@ -1875,7 +1875,7 @@ static int get_cur_inode_state(struct send_ctx *sctx, u64 ino, u64 gen,
> > >     int left_ret;
> > >     int right_ret;
> > >     u64 left_gen;
> > > -   u64 right_gen;
> > > +   u64 right_gen = 0;
> >
> > IIRC this is not my first time explaining why this is a false alert.
> >
> > Thus please report your compiler version first.
>
> This is probably because of the -Wmaybe-uninitialized we enabled, on
> some combination of architecture and compiler. While I'm also interested
> in the compiler and version we need to fix the warnings before 6.3 final.
> We'd be gettting the warnings and reports/patches, which is wasting
> peoples' time, it's not a big deal to initialize the variables. But
> still I also want to know which version reports that.

aarch64-linux-gnu-gcc (Debian 10.2.1-6) 10.2.1 20210110 and
aarch64-linux-gnu-gcc (7.3.0-20190804.h30.ky10.aarch64 )

Thanks,

Genjian.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ