Received: by 10.223.176.5 with SMTP id f5csp2819735wra; Mon, 5 Feb 2018 10:22:26 -0800 (PST) X-Google-Smtp-Source: AH8x224fOYtGJu3AF7lYkzHp3T791GJQXte8LYg31PNy1kfu/dGaUPr3lr45lTHIKZbu9J64YQVw X-Received: by 2002:a17:902:8f8b:: with SMTP id z11-v6mr22624938plo.43.1517854946777; Mon, 05 Feb 2018 10:22:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517854946; cv=none; d=google.com; s=arc-20160816; b=l1c8zr3JE/vl3ZOQcqiWu/ImCOmFb3Ra8n8UlxVlTj/+VJtFTrmMzhnHxbOpYzzPXo a5VDNZMsG+TWvKX45xNr2wmWzWnVYORXC4d1dSiEmpi2Ct5OAKjsPD8fG7LdzQq/MZuh pY/MNeERJbt+nh5wGTDK1FDydgH5e3YFbG5H/xv1r486bqMGolToi5VawjFF2NWWvDR2 /3my32t58gC9V8LufMn+H4WFv4XSa525u59ssZPohiUcQF7HGqUQ5OUTrIl1iwhVg5eh Sl3qnaNfUpuXUikRzX5dV8zY1b06RRWz1E6Hc3ohnwwBWcPf2aChpY6+VHLNYCIoIqF6 ZPgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=0Nlv7/bj6vXpSvaBeQ3AY0hET4EbUJkWONBApUVnOs4=; b=Mt1XmabmXOu4aV/tsdHmxt5hXbBEB9vJqv264fRJpzqckoPlalAKWKCF5UHSjGM3Yr bzv31mfDOicwiM4t2s5jMaZ+fMgWHG5dwrpJ5u2zGSSsuatsZCVcQteHdYWVUCoNFWK2 dtxNJGFUZZwtLQvUVTO+wV7hPeApOs76zzD9/wMjVDmiknJR522dsqNHT+KltNFGzhgH g1mQyU5Fg2eEsRSMbUkn/hmt9gSn6Ia/56+G5cOHlGtzXNq5vh08+MxndLlSFSQb5aRF B+jRlCscVX7F0qtm6E20b5jrDNZ3j69gaajwuEzdqDMPR2ebSUo8kEhqJq31lfJGvruH ZiBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p10-v6si5231417plo.810.2018.02.05.10.22.12; Mon, 05 Feb 2018 10:22:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753426AbeBESUr (ORCPT + 99 others); Mon, 5 Feb 2018 13:20:47 -0500 Received: from mga17.intel.com ([192.55.52.151]:33538 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752738AbeBESUl (ORCPT ); Mon, 5 Feb 2018 13:20:41 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Feb 2018 10:20:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,465,1511856000"; d="scan'208";a="28959109" Received: from theros.lm.intel.com (HELO linux.intel.com) ([10.232.112.164]) by orsmga001.jf.intel.com with ESMTP; 05 Feb 2018 10:20:39 -0800 Date: Mon, 5 Feb 2018 11:20:39 -0700 From: Ross Zwisler To: Colin King Cc: Dan Williams , linux-nvdimm@lists.01.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] libnvdimm: remove redundant assignment to pointer 'dev' Message-ID: <20180205182039.GA7891@linux.intel.com> References: <20180205140852.14110-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180205140852.14110-1-colin.king@canonical.com> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 05, 2018 at 02:08:52PM +0000, Colin King wrote: > From: Colin Ian King > > Pointer dev is being assigned a value that is never read, it is being > re-assigned the same value later on, hence the initialization is redundant > and can be removed. > > Cleans up clang warning: > drivers/nvdimm/pfn_devs.c:307:17: warning: Value stored to 'dev' during > its initialization is never read > > Signed-off-by: Colin Ian King Reviewed-by: Ross Zwisler More importantly this fixes a potential NULL pointer dereference. nd_pfn is checked for NULL a few lines down, but we would have crashed here trying to get nd_pfn->dev. We can append the above info to the changelog when we apply. > --- > drivers/nvdimm/pfn_devs.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c > index f5c4e8c6e29d..2f4d18752c97 100644 > --- a/drivers/nvdimm/pfn_devs.c > +++ b/drivers/nvdimm/pfn_devs.c > @@ -304,7 +304,7 @@ static const struct attribute_group *nd_pfn_attribute_groups[] = { > struct device *nd_pfn_devinit(struct nd_pfn *nd_pfn, > struct nd_namespace_common *ndns) > { > - struct device *dev = &nd_pfn->dev; > + struct device *dev; > > if (!nd_pfn) > return NULL; > -- > 2.15.1 > > _______________________________________________ > Linux-nvdimm mailing list > Linux-nvdimm@lists.01.org > https://lists.01.org/mailman/listinfo/linux-nvdimm