linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: fix uninitialized variable warning
       [not found] <20110603110011.77121203.sfr@canb.auug.org.au>
@ 2011-06-03 14:50 ` David Sterba
  2011-06-03 14:56   ` Chris Mason
  0 siblings, 1 reply; 10+ messages in thread
From: David Sterba @ 2011-06-03 14:50 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Chris Mason, linux-next, linux-kernel, Miao Xie, David Sterba,
	Tsutomu Itoh, Itaru Kitayama, linux-btrfs

From: David Sterba <dsterba@suse.cz>

With Linus' tree, today's linux-next build (powercp ppc64_defconfig)
produced this warning:

fs/btrfs/delayed-inode.c: In function 'btrfs_delayed_update_inode':
fs/btrfs/delayed-inode.c:1598:6: warning: 'ret' may be used
uninitialized in this function

Introduced by commit 16cdcec736cd ("btrfs: implement delayed inode items
operation").

This fixes a bug in btrfs_update_inode(): if the returned value from
btrfs_delayed_update_inode is a nonzero garbage, inode stat data are not
updated and several call paths may hit a BUG_ON or fail with strange
code.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David Sterba <dsterba@suse.cz>
---

patch pushed to git://repo.or.cz/linux-2.6/btrfs-unstable.git #fixes

 fs/btrfs/delayed-inode.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 01e2950..8cb012f 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -1595,7 +1595,7 @@ int btrfs_delayed_update_inode(struct btrfs_trans_handle *trans,
 			       struct btrfs_root *root, struct inode *inode)
 {
 	struct btrfs_delayed_node *delayed_node;
-	int ret;
+	int ret = 0;
 
 	delayed_node = btrfs_get_or_create_delayed_node(inode);
 	if (IS_ERR(delayed_node))
-- 
1.7.5.2.353.g5df3e

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] btrfs: fix uninitialized variable warning
  2011-06-03 14:50 ` [PATCH] btrfs: fix uninitialized variable warning David Sterba
@ 2011-06-03 14:56   ` Chris Mason
  0 siblings, 0 replies; 10+ messages in thread
From: Chris Mason @ 2011-06-03 14:56 UTC (permalink / raw)
  To: dave
  Cc: Stephen Rothwell, linux-next, linux-kernel, Miao Xie,
	Tsutomu Itoh, Itaru Kitayama, linux-btrfs

Excerpts from David Sterba's message of 2011-06-03 10:50:14 -0400:
> From: David Sterba <dsterba@suse.cz>
> 
> With Linus' tree, today's linux-next build (powercp ppc64_defconfig)
> produced this warning:
> 
> fs/btrfs/delayed-inode.c: In function 'btrfs_delayed_update_inode':
> fs/btrfs/delayed-inode.c:1598:6: warning: 'ret' may be used
> uninitialized in this function
> 
> Introduced by commit 16cdcec736cd ("btrfs: implement delayed inode items
> operation").
> 
> This fixes a bug in btrfs_update_inode(): if the returned value from
> btrfs_delayed_update_inode is a nonzero garbage, inode stat data are not
> updated and several call paths may hit a BUG_ON or fail with strange
> code.

Ugh, thanks!  It looks like the gcc uninit stuff isn't as verbose as it
used to be, but it does catch a bunch of allocated/set but not used
vars.

I have a nitems = 0 fix in my tree as well.

-chris

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] btrfs: fix uninitialized variable warning
@ 2023-03-24  2:08 Genjian
  2023-03-24  2:24 ` Qu Wenruo
  2023-04-06 19:12 ` David Sterba
  0 siblings, 2 replies; 10+ messages in thread
From: Genjian @ 2023-03-24  2:08 UTC (permalink / raw)
  To: clm, josef, dsterba; +Cc: linux-btrfs, linux-kernel, Genjian Zhang, k2ci

From: Genjian Zhang <zhanggenjian@kylinos.cn>

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@kylinos.cn>
Signed-off-by: Genjian Zhang <zhanggenjian@kylinos.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;
 	struct btrfs_inode_info info;
 
 	ret = get_inode_info(sctx->send_root, ino, &info);
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 7823168c08a6..7163c98e47be 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2609,7 +2609,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
 	struct block_device *bdev;
 	struct super_block *sb = fs_info->sb;
 	struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
-	struct btrfs_fs_devices *seed_devices;
+	struct btrfs_fs_devices *seed_devices = NULL;
 	u64 orig_super_total_bytes;
 	u64 orig_super_num_devices;
 	int ret = 0;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] btrfs: fix uninitialized variable warning
  2023-03-24  2:08 Genjian
@ 2023-03-24  2:24 ` Qu Wenruo
  2023-03-24  2:29   ` David Sterba
  2023-04-06 19:12 ` David Sterba
  1 sibling, 1 reply; 10+ messages in thread
From: Qu Wenruo @ 2023-03-24  2:24 UTC (permalink / raw)
  To: Genjian, clm, josef, dsterba
  Cc: linux-btrfs, linux-kernel, Genjian Zhang, k2ci



On 2023/3/24 10:08, Genjian wrote:
> From: Genjian Zhang <zhanggenjian@kylinos.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@kylinos.cn>
> Signed-off-by: Genjian Zhang <zhanggenjian@kylinos.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.

Thanks,
Qu
>   	struct btrfs_inode_info info;
>   
>   	ret = get_inode_info(sctx->send_root, ino, &info);
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 7823168c08a6..7163c98e47be 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -2609,7 +2609,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
>   	struct block_device *bdev;
>   	struct super_block *sb = fs_info->sb;
>   	struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
> -	struct btrfs_fs_devices *seed_devices;
> +	struct btrfs_fs_devices *seed_devices = NULL;
>   	u64 orig_super_total_bytes;
>   	u64 orig_super_num_devices;
>   	int ret = 0;

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] btrfs: fix uninitialized variable warning
  2023-03-24  2:24 ` Qu Wenruo
@ 2023-03-24  2:29   ` David Sterba
  2023-03-24  3:05     ` genjian zhang
  0 siblings, 1 reply; 10+ messages in thread
From: David Sterba @ 2023-03-24  2:29 UTC (permalink / raw)
  To: Qu Wenruo
  Cc: Genjian, clm, josef, dsterba, linux-btrfs, linux-kernel,
	Genjian Zhang, k2ci

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@kylinos.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@kylinos.cn>
> > Signed-off-by: Genjian Zhang <zhanggenjian@kylinos.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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] btrfs: fix uninitialized variable warning
  2023-03-24  2:29   ` David Sterba
@ 2023-03-24  3:05     ` genjian zhang
  2023-03-24  4:24       ` Qu Wenruo
  0 siblings, 1 reply; 10+ messages in thread
From: genjian zhang @ 2023-03-24  3:05 UTC (permalink / raw)
  To: dsterba
  Cc: Qu Wenruo, clm, josef, dsterba, linux-btrfs, linux-kernel,
	Genjian Zhang, k2ci

On Fri, Mar 24, 2023 at 10:35 AM David Sterba <dsterba@suse.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@kylinos.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@kylinos.cn>
> > > Signed-off-by: Genjian Zhang <zhanggenjian@kylinos.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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] btrfs: fix uninitialized variable warning
  2023-03-24  3:05     ` genjian zhang
@ 2023-03-24  4:24       ` Qu Wenruo
  2023-03-24  5:47         ` genjian zhang
  0 siblings, 1 reply; 10+ messages in thread
From: Qu Wenruo @ 2023-03-24  4:24 UTC (permalink / raw)
  To: genjian zhang, dsterba
  Cc: Qu Wenruo, clm, josef, dsterba, linux-btrfs, linux-kernel,
	Genjian Zhang, k2ci



On 2023/3/24 11:05, genjian zhang wrote:
> On Fri, Mar 24, 2023 at 10:35 AM David Sterba <dsterba@suse.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@kylinos.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@kylinos.cn>
>>>> Signed-off-by: Genjian Zhang <zhanggenjian@kylinos.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 )

Latest GCC 10.x is already 10.3, and 7.x is already 7.5.

Either report to your distro and let them update the toolchain, or find 
a way to make your bot shut up on the false alert.

> 
> Thanks,
> 
> Genjian.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] btrfs: fix uninitialized variable warning
  2023-03-24  4:24       ` Qu Wenruo
@ 2023-03-24  5:47         ` genjian zhang
  0 siblings, 0 replies; 10+ messages in thread
From: genjian zhang @ 2023-03-24  5:47 UTC (permalink / raw)
  To: Qu Wenruo
  Cc: dsterba, Qu Wenruo, clm, josef, dsterba, linux-btrfs,
	linux-kernel, Genjian Zhang, k2ci

On Fri, Mar 24, 2023 at 12:24 PM Qu Wenruo <wqu@suse.com> wrote:
>
>
>
> On 2023/3/24 11:05, genjian zhang wrote:
> > On Fri, Mar 24, 2023 at 10:35 AM David Sterba <dsterba@suse.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@kylinos.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@kylinos.cn>
> >>>> Signed-off-by: Genjian Zhang <zhanggenjian@kylinos.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 )
>
> Latest GCC 10.x is already 10.3, and 7.x is already 7.5.
>
> Either report to your distro and let them update the toolchain, or find
> a way to make your bot shut up on the false alert.
>
> >
> > Thanks,
> >
> > Genjian.

OK, thank you for your suggestion and reply.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] btrfs: fix uninitialized variable warning
  2023-03-24  2:08 Genjian
  2023-03-24  2:24 ` Qu Wenruo
@ 2023-04-06 19:12 ` David Sterba
  2023-04-23  9:21   ` genjian zhang
  1 sibling, 1 reply; 10+ messages in thread
From: David Sterba @ 2023-04-06 19:12 UTC (permalink / raw)
  To: Genjian; +Cc: clm, josef, dsterba, linux-btrfs, linux-kernel, Genjian Zhang,
	k2ci

On Fri, Mar 24, 2023 at 10:08:38AM +0800, Genjian wrote:
> From: Genjian Zhang <zhanggenjian@kylinos.cn>
> 
> 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@kylinos.cn>
> Signed-off-by: Genjian Zhang <zhanggenjian@kylinos.cn>

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] btrfs: fix uninitialized variable warning
  2023-04-06 19:12 ` David Sterba
@ 2023-04-23  9:21   ` genjian zhang
  0 siblings, 0 replies; 10+ messages in thread
From: genjian zhang @ 2023-04-23  9:21 UTC (permalink / raw)
  To: dsterba; +Cc: clm, josef, dsterba, linux-btrfs, linux-kernel, Genjian Zhang,
	k2ci

On Fri, Apr 7, 2023 at 3:12 AM David Sterba <dsterba@suse.cz> wrote:
>
> On Fri, Mar 24, 2023 at 10:08:38AM +0800, Genjian wrote:
> > From: Genjian Zhang <zhanggenjian@kylinos.cn>
> >
> > 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@kylinos.cn>
> > Signed-off-by: Genjian Zhang <zhanggenjian@kylinos.cn>
>
> 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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-04-23  9:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20110603110011.77121203.sfr@canb.auug.org.au>
2011-06-03 14:50 ` [PATCH] btrfs: fix uninitialized variable warning David Sterba
2011-06-03 14:56   ` Chris Mason
2023-03-24  2:08 Genjian
2023-03-24  2:24 ` Qu Wenruo
2023-03-24  2:29   ` David Sterba
2023-03-24  3:05     ` genjian zhang
2023-03-24  4:24       ` Qu Wenruo
2023-03-24  5:47         ` genjian zhang
2023-04-06 19:12 ` David Sterba
2023-04-23  9:21   ` genjian zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).