]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_spaceman: fix potential overflowing expression in trim_f()
authorBill O'Donnell <billodo@redhat.com>
Thu, 29 Jun 2017 18:05:59 +0000 (13:05 -0500)
committerEric Sandeen <sandeen@redhat.com>
Thu, 29 Jun 2017 18:05:59 +0000 (13:05 -0500)
Prevent the potential overflow in expression calculating offset
in trim_f(() by casting the first variable to off64_t (64bit signed).

Addresses-Coverity-Id: 1413771

Signed-off-by: Bill O'Donnell <billodo@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
spaceman/trim.c

index 872f68d370274b33272c43bcc0e71ed09e88046a..6df9e6a968ebc9cdeba57542c07853afcd179d90 100644 (file)
@@ -77,7 +77,7 @@ trim_f(
                length = cvtnum(file->geom.blocksize, file->geom.sectsize,
                                argv[optind + 1]);
        } else if (agno) {
-               offset = agno * file->geom.agblocks * file->geom.blocksize;
+               offset = (off64_t)agno * file->geom.agblocks * file->geom.blocksize;
                length = file->geom.agblocks * file->geom.blocksize;
        } else {
                offset = 0;