From patchwork Mon Jun 12 20:43:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 9782727 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9287560352 for ; Mon, 12 Jun 2017 20:49:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8674C284B5 for ; Mon, 12 Jun 2017 20:49:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78AF2284DB; Mon, 12 Jun 2017 20:49:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 78F3A284B5 for ; Mon, 12 Jun 2017 20:49:56 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E976421A02F37; Mon, 12 Jun 2017 13:48:41 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 841A221BB2528 for ; Mon, 12 Jun 2017 13:48:40 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jun 2017 13:49:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,334,1493708400"; d="scan'208";a="113996460" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.125]) by fmsmga006.fm.intel.com with ESMTP; 12 Jun 2017 13:49:47 -0700 Subject: [ndctl PATCH] ndctl, create-namespace: fix uninitialized 'size_align' From: Dan Williams To: linux-nvdimm@lists.01.org Date: Mon, 12 Jun 2017 13:43:20 -0700 Message-ID: <149730020007.28869.12430033783348592440.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.22 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-Virus-Scanned: ClamAV using ClamSMTP Static analysis reports that 'size_align' could be used uninitialized, so set the default at definition time. Signed-off-by: Dan Williams Reviewed-by: Vishal Verma Acked-by: Jeff Moyer --- ndctl/namespace.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ndctl/namespace.c b/ndctl/namespace.c index 895e39bb8c7d..4e39975d5b6a 100644 --- a/ndctl/namespace.c +++ b/ndctl/namespace.c @@ -428,7 +428,7 @@ static int validate_namespace_options(struct ndctl_region *region, struct ndctl_namespace *ndns, struct parsed_parameters *p) { const char *region_name = ndctl_region_get_devname(region); - unsigned long long size_align, units = 1; + unsigned long long size_align = SZ_4K, units = 1; unsigned int ways; int rc = 0; @@ -540,8 +540,6 @@ static int validate_namespace_options(struct ndctl_region *region, if (p->mode == NDCTL_NS_MODE_MEMORY || p->mode == NDCTL_NS_MODE_DAX) size_align = p->align; - else - size_align = SZ_4K; } /* (re-)validate that the size satisfies the alignment */