diff mbox

[ndctl,6/8] ndctl, create-namespace: fix memmap location reconfiguration

Message ID 146135445365.4228.4660592942992248223.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State Accepted
Commit 40676aef86b3
Headers show

Commit Message

Dan Williams April 22, 2016, 7:47 p.m. UTC
Fix segfault resulting from:

    ndctl create-namespace -M map -e namespace0.0 -f

...when 'memory' mode is implied by the source namespace.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 builtin-xaction-namespace.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/builtin-xaction-namespace.c b/builtin-xaction-namespace.c
index 23b38ad0b73b..7d555a7d14a1 100644
--- a/builtin-xaction-namespace.c
+++ b/builtin-xaction-namespace.c
@@ -165,7 +165,8 @@  static int set_defaults(enum namespace_action mode)
 			rc = -EINVAL;
 		}
 
-		if (!param.reconfig && strcmp(param.mode, "memory") != 0) {
+		if (!param.reconfig && param.mode
+				&& strcmp(param.mode, "memory") != 0) {
 			error("--map only valid for a memory mode pmem namespace\n");
 			rc = -EINVAL;
 		}