Skip to contentSkip to conversation

master - raid: Fail if kernel status denominator is zero.

PATCH Alasdair Kergon 1 participant 1 message Sep 28, 2015 MD RAID

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d94ff2092709c600524f732b8bc98cd692562bcb
Commit:        d94ff2092709c600524f732b8bc98cd692562bcb
Parent:        0173c260d8270465f1895044b34609008962cc00
Author:        Alasdair G Kergon <[email protected]>
AuthorDate:    Mon Sep 28 20:45:44 2015 +0100
Committer:     Alasdair G Kergon <[email protected]>
CommitterDate: Mon Sep 28 20:45:44 2015 +0100

raid: Fail if kernel status denominator is zero.

---
 lib/raid/raid.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
lib/raid/raid.c +2 -2
index f75e1f7..0814cba 100644
@@ -280,8 +280,8 @@ static int _raid_target_percent(void **target_state,
 		else
 			break;
 	}
-	if (!pos || (sscanf(pos, FMTu64 "/" FMTu64 "%n",
-			    &numerator, &denominator, &i) != 2)) {
+	if (!pos || (sscanf(pos, FMTu64 "/" FMTu64 "%n", &numerator, &denominator, &i) != 2) ||
+	    !denominator) {
 		log_error("Failed to parse %s status fraction: %s",
 			  (seg) ? seg->segtype->name : "segment", params);
 		return 0;