Skip to contentSkip to conversation

master - raid: fix the string compare

PATCH Zdenek Kabelac 1 participant 1 message Nov 10, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a45cc0fe1460168f2e193c210aabaa1292fe0ea3
Commit:        a45cc0fe1460168f2e193c210aabaa1292fe0ea3
Parent:        59905100d1326bc651a3b5991fdaed563abcf41e
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Tue Nov 10 21:32:46 2015 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Tue Nov 10 21:40:28 2015 +0100

raid: fix the string compare

Coverity noticed this condition is always false and the error path could never be visited.

So check for all mismatches of supported messages
and actually mark log_error as internal error.

---
 lib/activate/dev_manager.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
lib/activate/dev_manager.c +8 -8
index 0b24f86..fd4d842 100644
@@ -1410,14 +1410,14 @@ int dev_manager_raid_message(struct dev_manager *dm,
 	}
 
 	/* These are the supported RAID messages for dm-raid v1.5.0 */
-	if (!strcmp(msg, "idle") &&
-	    !strcmp(msg, "frozen") &&
-	    !strcmp(msg, "resync") &&
-	    !strcmp(msg, "recover") &&
-	    !strcmp(msg, "check") &&
-	    !strcmp(msg, "repair") &&
-	    !strcmp(msg, "reshape")) {
-		log_error("Unknown RAID message: %s", msg);
+	if (strcmp(msg, "idle") &&
+	    strcmp(msg, "frozen") &&
+	    strcmp(msg, "resync") &&
+	    strcmp(msg, "recover") &&
+	    strcmp(msg, "check") &&
+	    strcmp(msg, "repair") &&
+	    strcmp(msg, "reshape")) {
+		log_error(INTERNAL_ERROR "Unknown RAID message: %s", msg);
 		return 0;
 	}