public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH] xfs: fix uninit warning in xfs_growfs_data
Date: Fri, 7 Jul 2023 08:54:10 +1000	[thread overview]
Message-ID: <ZKdGEmx7T4fw4S7E@dread.disaster.area> (raw)
In-Reply-To: <20230706022630.GA11476@frogsfrogsfrogs>

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

  reply	other threads:[~2023-07-06 22:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-06  2:26 [PATCH] xfs: fix uninit warning in xfs_growfs_data Darrick J. Wong
2023-07-06 22:54 ` Dave Chinner [this message]
2023-07-06 23:51   ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZKdGEmx7T4fw4S7E@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox