* [PATCH] xfs: fix uninit warning in xfs_growfs_data
@ 2023-07-06 2:26 Darrick J. Wong
2023-07-06 22:54 ` Dave Chinner
0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2023-07-06 2:26 UTC (permalink / raw)
To: Dave Chinner; +Cc: xfs
From: Darrick J. Wong <djwong@kernel.org>
Quiet down this gcc warning:
fs/xfs/xfs_fsops.c: In function ‘xfs_growfs_data’:
fs/xfs/xfs_fsops.c:219:21: error: ‘lastag_extended’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
219 | if (lastag_extended) {
| ^~~~~~~~~~~~~~~
fs/xfs/xfs_fsops.c:100:33: note: ‘lastag_extended’ was declared here
100 | bool lastag_extended;
| ^~~~~~~~~~~~~~~
By setting its value explicitly. From code analysis I don't think this
is a real problem, but I have better things to do than analyse this
closely.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
fs/xfs/xfs_fsops.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
index 65473bc52c7d..96edc87bf030 100644
--- a/fs/xfs/xfs_fsops.c
+++ b/fs/xfs/xfs_fsops.c
@@ -97,7 +97,7 @@ xfs_growfs_data_private(
xfs_agnumber_t nagimax = 0;
xfs_rfsblock_t nb, nb_div, nb_mod;
int64_t delta;
- bool lastag_extended;
+ bool lastag_extended = false;
xfs_agnumber_t oagcount;
struct xfs_trans *tp;
struct aghdr_init_data id = {};
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: fix uninit warning in xfs_growfs_data
2023-07-06 2:26 [PATCH] xfs: fix uninit warning in xfs_growfs_data Darrick J. Wong
@ 2023-07-06 22:54 ` Dave Chinner
2023-07-06 23:51 ` Darrick J. Wong
0 siblings, 1 reply; 3+ messages in thread
From: Dave Chinner @ 2023-07-06 22:54 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: xfs
On Wed, Jul 05, 2023 at 07:26:30PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Quiet down this gcc warning:
>
> fs/xfs/xfs_fsops.c: In function ‘xfs_growfs_data’:
> fs/xfs/xfs_fsops.c:219:21: error: ‘lastag_extended’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 219 | if (lastag_extended) {
> | ^~~~~~~~~~~~~~~
> fs/xfs/xfs_fsops.c:100:33: note: ‘lastag_extended’ was declared here
> 100 | bool lastag_extended;
> | ^~~~~~~~~~~~~~~
>
> By setting its value explicitly. From code analysis I don't think this
> is a real problem, but I have better things to do than analyse this
> closely.
Huh. What compiler is complaining about that?
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
> fs/xfs/xfs_fsops.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
> index 65473bc52c7d..96edc87bf030 100644
> --- a/fs/xfs/xfs_fsops.c
> +++ b/fs/xfs/xfs_fsops.c
> @@ -97,7 +97,7 @@ xfs_growfs_data_private(
> xfs_agnumber_t nagimax = 0;
> xfs_rfsblock_t nb, nb_div, nb_mod;
> int64_t delta;
> - bool lastag_extended;
> + bool lastag_extended = false;
> xfs_agnumber_t oagcount;
> struct xfs_trans *tp;
> struct aghdr_init_data id = {};
Looks good,
Reviewed-by: Dave Chinner <dchinner@redhat.com>
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: fix uninit warning in xfs_growfs_data
2023-07-06 22:54 ` Dave Chinner
@ 2023-07-06 23:51 ` Darrick J. Wong
0 siblings, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2023-07-06 23:51 UTC (permalink / raw)
To: Dave Chinner; +Cc: xfs
On Fri, Jul 07, 2023 at 08:54:10AM +1000, Dave Chinner wrote:
> On Wed, Jul 05, 2023 at 07:26:30PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > Quiet down this gcc warning:
> >
> > fs/xfs/xfs_fsops.c: In function ‘xfs_growfs_data’:
> > fs/xfs/xfs_fsops.c:219:21: error: ‘lastag_extended’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > 219 | if (lastag_extended) {
> > | ^~~~~~~~~~~~~~~
> > fs/xfs/xfs_fsops.c:100:33: note: ‘lastag_extended’ was declared here
> > 100 | bool lastag_extended;
> > | ^~~~~~~~~~~~~~~
> >
> > By setting its value explicitly. From code analysis I don't think this
> > is a real problem, but I have better things to do than analyse this
> > closely.
>
> Huh. What compiler is complaining about that?
gcc 11.3, though oddly this only happens when I turn on gcov. Not sure
what sorcery gets enabled with that, but it got in the way of teaching
the fstests cloud to spit out 60MB(!) of coverage reports for each
fstests run, and the source code fix seemed obvious.
>
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> > fs/xfs/xfs_fsops.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
> > index 65473bc52c7d..96edc87bf030 100644
> > --- a/fs/xfs/xfs_fsops.c
> > +++ b/fs/xfs/xfs_fsops.c
> > @@ -97,7 +97,7 @@ xfs_growfs_data_private(
> > xfs_agnumber_t nagimax = 0;
> > xfs_rfsblock_t nb, nb_div, nb_mod;
> > int64_t delta;
> > - bool lastag_extended;
> > + bool lastag_extended = false;
> > xfs_agnumber_t oagcount;
> > struct xfs_trans *tp;
> > struct aghdr_init_data id = {};
>
> Looks good,
>
> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Thanks!
--D
> Dave Chinner
> david@fromorbit.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-06 23:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-06 2:26 [PATCH] xfs: fix uninit warning in xfs_growfs_data Darrick J. Wong
2023-07-06 22:54 ` Dave Chinner
2023-07-06 23:51 ` Darrick J. Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox