From patchwork Fri Apr 22 19:47:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 8915401 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1A2489F372 for ; Fri, 22 Apr 2016 19:48:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 554F22021B for ; Fri, 22 Apr 2016 19:48:24 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9236320212 for ; Fri, 22 Apr 2016 19:48:23 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8773D1A2148; Fri, 22 Apr 2016 12:48:23 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by ml01.01.org (Postfix) with ESMTP id C453E1A2148 for ; Fri, 22 Apr 2016 12:48:22 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 22 Apr 2016 12:48:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,518,1455004800"; d="scan'208";a="790419660" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.14]) by orsmga003.jf.intel.com with ESMTP; 22 Apr 2016 12:48:22 -0700 Subject: [ndctl PATCH 6/8] ndctl, create-namespace: fix memmap location reconfiguration From: Dan Williams To: linux-nvdimm@lists.01.org Date: Fri, 22 Apr 2016 12:47:33 -0700 Message-ID: <146135445365.4228.4660592942992248223.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <146135442234.4228.904225076597683142.stgit@dwillia2-desk3.amr.corp.intel.com> References: <146135442234.4228.904225076597683142.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- builtin-xaction-namespace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; }