diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2016-07-04 19:25:40 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2016-07-06 09:59:45 +0100 |
commit | 1faa208067df2989c716fff40568f3948392b186 (patch) | |
tree | 102f90cb3b63a7434aab76f17aafb952c40608fb | |
parent | 21b946dfb75c893827ce5caafd16cb09be4fbeeb (diff) | |
download | lvm2-1faa208067df2989c716fff40568f3948392b186.tar.gz |
dmstats: simplify nr_areas calculation (CWE-561)
Eliminate dead conditional (step cannot be zero).
Fixes commit 988ca74.
-rw-r--r-- | tools/dmsetup.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/dmsetup.c b/tools/dmsetup.c index 4d9bb0709..b67562562 100644 --- a/tools/dmsetup.c +++ b/tools/dmsetup.c @@ -4745,7 +4745,7 @@ static uint64_t _nr_areas_from_step(uint64_t len, int64_t step) return (uint64_t)(-step); /* --areasize - cast step to unsigned as it cannot be -ve here. */ - return (len / (step ? : len)) + !!(len % (uint64_t) step); + return (len / step) + !!(len % (uint64_t) step); } /* |