Skip to contentSkip to conversation

main - cov: add internal error for missing arg

PATCH Zdenek Kabelac 1 participant 1 message Jul 27, 2021

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=046d85af3d7a103573e56ef6861dc5d6ded9ecc7
Commit:        046d85af3d7a103573e56ef6861dc5d6ded9ecc7
Parent:        69379df8f35404269e5aa4a275a7686a87076f27
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Tue Jul 27 15:40:26 2021 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Wed Jul 28 00:49:28 2021 +0200

cov: add internal error for missing arg

Analyzer is happier.

---
 tools/lvchange.c | 5 +++++
 1 file changed, 5 insertions(+)
tools/lvchange.c +5 -0
index 8293f5035..bfd464d5c 100644
@@ -1685,6 +1685,11 @@ static int _lvchange_syncaction_single(struct cmd_context *cmd,
 {
 	const char *msg = arg_str_value(cmd, syncaction_ARG, NULL);
 
+	if (!msg) {
+		log_error(INTERNAL_ERROR "Missing syncaction arg.");
+		return ECMD_FAILED;
+	}
+
 	if (lv_raid_has_integrity(lv) && !strcmp(msg, "repair")) {
 		log_error("Use syncaction check to detect and correct integrity checksum mismatches.");
 		return ECMD_FAILED;