From 856f9cced83078a90ca2291eff0758d42775f195 Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Mon, 10 Aug 2015 19:18:16 +0100 Subject: [PATCH] libdm: simplify stats nr_areas calculation (Coverity) Remove an unneccessary conditional operator and simplify the logic in _nr_areas: libdm/libdm-stats.c: 501 in _nr_areas() - Control flow issues (DEADCODE) --- libdm/libdm-stats.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c index a672e0562..192326e63 100644 --- a/libdm/libdm-stats.c +++ b/libdm/libdm-stats.c @@ -503,8 +503,7 @@ static uint64_t _nr_areas(uint64_t len, uint64_t step) * treat the entire region as a single area. Any partial area at the * end of the region is treated as an additional complete area. */ - return (len && step) - ? (len / (step ? step : len)) + !!(len % step) : 0; + return (len / (step ? : len)) + !!(len % step); } static uint64_t _nr_areas_region(struct dm_stats_region *region)