xfs
[Top] [All Lists]

Re: [PATCH V3] xfs_io: don't assign cvtnum() return to unsigned var

To: Eric Sandeen <sandeen@xxxxxxxxxxx>
Subject: Re: [PATCH V3] xfs_io: don't assign cvtnum() return to unsigned var
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Thu, 3 Dec 2009 11:59:31 -0500
Cc: xfs-oss <xfs@xxxxxxxxxxx>
In-reply-to: <4B16BACB.3030401@xxxxxxxxxxx>
References: <4B16AFCA.5040302@xxxxxxxxxxx> <4B16B14A.40709@xxxxxxxxxxx> <4B16BACB.3030401@xxxxxxxxxxx>
User-agent: Mutt/1.5.19 (2009-01-05)
On Wed, Dec 02, 2009 at 01:06:51PM -0600, Eric Sandeen wrote:
> (whoops meant to include 2 fixes in that)
> (argh and fadvise too, I think this is the last one, sorry!)
> 
> cvtnum() returns -1LL for unparseable values, but if we
> assign to a signed var, we can't test it:
> 
> There are problems in fadvise, mincore & madvise.
> 
> xfs_io> mincore 0 xxx
> range (0:0) is beyond mapping (0:1048576)
> 
> For mincore & madvise, se a temporary signed var so we
> can detect the error:
> 
> xfs_io> mincore 0 xxx
> non-numeric length argument -- xxx
> 
> and also test whether it may overflow a size_t for
> mincore & madvise.
> 
> For fadvise, posix_fadvise64 wants an off_t anyway so just
> switch to that.

Looks good even with all three covered,


Reviewed-by: Christoph Hellwig <hch@xxxxxx>

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