]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs_io: don't assign cvtnum() return to unsigned var
authorEric Sandeen <sandeen@sandeen.net>
Thu, 3 Dec 2009 19:20:54 +0000 (13:20 -0600)
committerEric Sandeen <sandeen@sandeen.net>
Thu, 3 Dec 2009 19:20:54 +0000 (13:20 -0600)
commit3b1cdc9fddcae5d92fcebc1f859453fb05020a0c
treed5a9bc8a89672348241f45a66c1aa933bb1e99cb
parent1e84eb5b6043f9286aa620d4daee49e163abb732
xfs_io: don't assign cvtnum() return to unsigned var

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.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Christoph Hellwig <hch@lst.de>
io/fadvise.c
io/madvise.c
io/mincore.c