xfs
[Top] [All Lists]

Re: [PATCH v2 3/4] xfsprogs: mkfs: fix unintentional integer overflow

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH v2 3/4] xfsprogs: mkfs: fix unintentional integer overflow
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Mon, 21 Dec 2015 10:51:01 +1100
Cc: Vivek Trivedi <t.vivek@xxxxxxxxxxx>, a.sahrawat@xxxxxxxxxxx, pankaj.m@xxxxxxxxxxx, xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20151220153649.GE20135@xxxxxxxxxxxxx>
References: <1449832143-26356-1-git-send-email-t.vivek@xxxxxxxxxxx> <1449832143-26356-4-git-send-email-t.vivek@xxxxxxxxxxx> <20151220153649.GE20135@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Sun, Dec 20, 2015 at 07:36:49AM -0800, Christoph Hellwig wrote:
> > +++ b/mkfs/xfs_mkfs.c
> > @@ -2022,7 +2022,7 @@ _("warning: sparse inodes not supported without CRC 
> > support, disabled.\n"));
> >              * and the underlying volume is striped, then set rtextblocks
> >              * to the stripe width.
> >              */
> > -           int             rswidth;
> > +           __uint64_t      rswidth;
> >             __uint64_t      rtextbytes;
> 
> This looks odd.  We initiallize assigned ft.rtswidth (which is an int)
> or 0 to it.  I think you want a separate variable for the result of
> the  DTOBT(rswidth) statement to make this clear.

I don't see any point in doing that. It really doesn't matter that
the variable it is initialised from is only a 32 bit int, and having
yet another variable in mkfs is not going to make the code easier to
understand...

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>