From patchwork Mon Apr 25 19:50:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 8931931 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DFB9BBF29F for ; Mon, 25 Apr 2016 19:51:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 124FA201EC for ; Mon, 25 Apr 2016 19:51:12 +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 18BAC2015A for ; Mon, 25 Apr 2016 19:51:11 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 089C11A1F64; Mon, 25 Apr 2016 12:51:11 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ml01.01.org (Postfix) with ESMTP id AC4BD1A1F64 for ; Mon, 25 Apr 2016 12:51:09 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP; 25 Apr 2016 12:51:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,534,1455004800"; d="scan'208";a="91690371" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.14]) by fmsmga004.fm.intel.com with ESMTP; 25 Apr 2016 12:51:10 -0700 Subject: [ndctl PATCH 6/7] ndctl: fix uninitialized variable in add_dimm() From: Dan Williams To: linux-nvdimm@lists.01.org Date: Mon, 25 Apr 2016 12:50:20 -0700 Message-ID: <146161382084.21779.5170696006378099616.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <146161378966.21779.1219526957524644729.stgit@dwillia2-desk3.amr.corp.intel.com> References: <146161378966.21779.1219526957524644729.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 Static analysis notes 'rc' might not be set if we fail to allocate 'dimm'. Signed-off-by: Dan Williams --- lib/libndctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libndctl.c b/lib/libndctl.c index 5c2894d6b82e..58b7fa9d6666 100644 --- a/lib/libndctl.c +++ b/lib/libndctl.c @@ -1184,9 +1184,9 @@ static struct kmod_module *to_module(struct ndctl_ctx *ctx, const char *alias); static int add_dimm(void *parent, int id, const char *dimm_base) { - int rc, formats, i; struct ndctl_dimm *dimm; char buf[SYSFS_ATTR_SIZE]; + int rc = -ENOMEM, formats, i; struct ndctl_bus *bus = parent; struct ndctl_ctx *ctx = bus->ctx; char *path = calloc(1, strlen(dimm_base) + 100);