Skip to contentSkip to conversation

master - cache: ensure there is no NULL str

PATCH Zdenek Kabelac 1 participant 1 message Nov 9, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=76b42901c08bd66df600f3ad82fc2f179a3abc8a
Commit:        76b42901c08bd66df600f3ad82fc2f179a3abc8a
Parent:        b1215b7f8c60f9484b0d6c032b24ea7e029505b0
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Mon Nov 9 16:56:11 2015 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Mon Nov 9 17:04:10 2015 +0100

cache: ensure there is no NULL str

Coverity is not smart enough to detect this case could never happen.

---
 lib/metadata/cache_manip.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
lib/metadata/cache_manip.c +4 -1
index 12b6d66..449d8df 100644
@@ -79,7 +79,10 @@ int cache_set_mode(struct lv_segment *seg, const char *str)
 		    find_config_node(cmd, cmd->cft, allocation_cache_pool_cachemode_CFG))
 			id = allocation_cache_pool_cachemode_CFG;
 
-		str = find_config_tree_str(cmd, id, NULL);
+		if (!(str = find_config_tree_str(cmd, id, NULL))) {
+			log_error(INTERNAL_ERROR "Cache mode is not determined.");
+			return 0;
+		}
 	}
 
 	if (!strcmp(str, "writeback"))