aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill O'Donnell <billodo@redhat.com>2017-06-29 13:05:59 -0500
committerEric Sandeen <sandeen@redhat.com>2017-06-29 13:05:59 -0500
commiteb125dcbfcd24bd40d6f78442a5814debc78438b (patch)
treed29ac42a22e6364e6935b6c58ff5e2c322a78a7f
parent1cda90906c093d30911c0a20f214d68a1d220cdd (diff)
downloadxfsprogs-dev-eb125dcbfcd24bd40d6f78442a5814debc78438b.tar.gz
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 <billodo@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
-rw-r--r--spaceman/trim.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/spaceman/trim.c b/spaceman/trim.c
index 872f68d370..6df9e6a968 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;