Skip to contentSkip to conversation

master - dmstats: simplify nr_areas calculation (CWE-561)

PATCH Bryn Reeves 1 participant 1 message Jul 6, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1faa208067df2989c716fff40568f3948392b186
Commit:        1faa208067df2989c716fff40568f3948392b186
Parent:        21b946dfb75c893827ce5caafd16cb09be4fbeeb
Author:        Bryn M. Reeves <[email protected]>
AuthorDate:    Mon Jul 4 19:25:40 2016 +0100
Committer:     Bryn M. Reeves <[email protected]>
CommitterDate: Wed Jul 6 09:59:45 2016 +0100

dmstats: simplify nr_areas calculation (CWE-561)

Eliminate dead conditional (step cannot be zero).

Fixes commit 988ca74.

---
 tools/dmsetup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/dmsetup.c +1 -1
index 4d9bb07..b675625 100644
@@ -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);
 }
 
 /*