]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
mkfs: don't crash on dswidth overflow
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 2 Feb 2018 15:32:43 +0000 (09:32 -0600)
committerEric Sandeen <sandeen@redhat.com>
Fri, 2 Feb 2018 15:32:43 +0000 (09:32 -0600)
commit91c7d131631626eb701b149104aceae10ff1cb45
tree303d892c5a36b1bf9e597e51f995ad6e8cac0d63
parent25f9772ab25ae1e35869ed71ecea951792e3fa10
mkfs: don't crash on dswidth overflow

I ran mkfs.xfs -d su=1048576,sw=$((18 * 1048576)), forgetting that sw
takes a multiple of su (unlike swidth which takes any space unit).  I
was surprised when we hit a floating point exception, which I traced
back to an integer overflow when we calculate swidth from dsw.

So, do the 64-bit multiplication so we can detect the overflow and
complain about it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
mkfs/xfs_mkfs.c