summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2015-08-17 18:31:11 +0100
committerBryn M. Reeves <bmr@redhat.com>2015-08-17 18:37:16 +0100
commit69fa16048a61b6cd0b8fe9c311dd4e9eea532207 (patch)
tree2e3c4f92b082394e75ad62257e6ea3b85bda451a
parentb01e9651b06a6362339d4c3d5d8da43896dae50f (diff)
downloadlvm2-69fa16048a61b6cd0b8fe9c311dd4e9eea532207.tar.gz
dmstats: check for zero in _nr_areas_from_step() (Coverity)
-rw-r--r--tools/dmsetup.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 8bcf4d5c8..7769fde6b 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -4434,6 +4434,10 @@ static int _size_from_string(char *argptr, uint64_t *size, const char *name)
*/
static uint64_t _nr_areas_from_step(uint64_t len, int64_t step)
{
+ /* Default is one area. */
+ if (!step || !len)
+ return 1;
+
/* --areas */
if (step < 0)
return (uint64_t)(-step);