[PATCH V3] xfs_io: don't assign cvtnum() return to unsigned var
Christoph Hellwig
hch at infradead.org
Thu Dec 3 10:59:31 CST 2009
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 at lst.de>
More information about the xfs
mailing list