Re: [PATCH 25/36] xfs_repair: fix uninitialized variable warnings

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

 



On Tue, Mar 26, 2019 at 02:56:02PM -0500, Eric Sandeen wrote:
> On 3/14/19 4:06 PM, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> > 
> > Fix some uninitialized variable warnings because ASSERT disappears if
> > DEBUG is not defined.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> 
> Fixes: commit 5857dce9e ("xfs_repair: check and repair quota metadata")
> 
> which was mine ;)
> 
> But, I wonder if we should really just happily carry on w/ an invalid
> quota type 0 on a non-debug build.  I don't know how that will end.
> 
> Maybe we should just switch it to a hard assert(0) because it really
> can only happen on a programming error today.

Yeah, we ought to be more defensive about that, since in theory we could
introduce a subtle bug some day where we validate a corrupt dquot with
flags == 0.

/me kinda wonders why we define away the asserts for repair, since it's
not like continuing under invalid premises in a repair tool is a good
idea.

--D

> 
> > ---
> >  repair/dinode.c |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > 
> > diff --git a/repair/dinode.c b/repair/dinode.c
> > index f670bf87..c0a56daa 100644
> > --- a/repair/dinode.c
> > +++ b/repair/dinode.c
> > @@ -1176,8 +1176,8 @@ process_quota_inode(
> >  	struct xfs_buf		*bp;
> >  	xfs_filblks_t		dqchunklen;
> >  	uint			dqperchunk;
> > -	int			quota_type;
> > -	char			*quota_string;
> > +	int			quota_type = 0;
> > +	char			*quota_string = NULL;
> >  	xfs_dqid_t		dqid;
> >  	xfs_fileoff_t		qbno;
> >  	int			i;
> > 



[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