From: Bill O'Donnell Date: Thu, 29 Jun 2017 18:05:59 +0000 (-0500) Subject: xfs_spaceman: fix potential overflowing expression in trim_f() X-Git-Tag: v4.12.0-rc1~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb125dcbfcd24bd40d6f78442a5814debc78438b;p=thirdparty%2Fxfsprogs-dev.git xfs_spaceman: fix potential overflowing expression in trim_f() 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 Reviewed-by: Darrick J. Wong Signed-off-by: Eric Sandeen --- diff --git a/spaceman/trim.c b/spaceman/trim.c index 872f68d37..6df9e6a96 100644 --- a/spaceman/trim.c +++ b/spaceman/trim.c @@ -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;