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>
struct cli_params *cli,
struct fs_topology *ft)
{
+ long long int big_dswidth;
int dsunit = 0;
int dswidth = 0;
int lsunit = 0;
}
dsunit = (int)BTOBBT(dsu);
- dswidth = dsunit * dsw;
+ big_dswidth = (long long int)dsunit * dsw;
+ if (big_dswidth > INT_MAX) {
+ fprintf(stderr,
+_("data stripe width (%lld) is too large of a multiple of the data stripe unit (%d)\n"),
+ big_dswidth, dsunit);
+ usage();
+ }
+ dswidth = big_dswidth;
}
if (dsunit && (dswidth % dsunit != 0)) {