Re: [PATCH] xfs: fix uninit warning in xfs_growfs_data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 05, 2023 at 07:26:30PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
> ---
>  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@xxxxxxxxxx>
-- 
Dave Chinner
david@xxxxxxxxxxxxx



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux