]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_repair: resolve Coverity OVERFLOW_BEFORE_WIDEN
authorBill O'Donnell <billodo@redhat.com>
Wed, 29 Jun 2016 01:13:03 +0000 (11:13 +1000)
committerDave Chinner <david@fromorbit.com>
Wed, 29 Jun 2016 01:13:03 +0000 (11:13 +1000)
Coverity complains that when multiplying two 32 bit values that
eventually will be stored in a 64 bit value that it's possible
the math could overflow unless one of the values being multiplied
is type cast to the proper size.

Signed-off-by: Bill O'Donnell <billodo@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
repair/sb.c

index 39659532d57c67b3da7573f79ee04b04d781c42a..8d4843cb745ea5b921e8b324a227b55e95b6ba1a 100644 (file)
@@ -230,7 +230,7 @@ find_secondary_sb(xfs_sb_t *rsb)
        do_warn(_("\nattempting to find secondary superblock...\n"));
 
        if (verify_sb_blocksize(rsb) == 0) {
-               skip = rsb->sb_agblocks * rsb->sb_blocksize;
+               skip = (__uint64_t)rsb->sb_agblocks * rsb->sb_blocksize;
                if (skip >= XFS_AG_MIN_BYTES && skip <= XFS_AG_MAX_BYTES)
                        retval = __find_secondary_sb(rsb, skip, skip);
        }