Received: by 10.223.176.5 with SMTP id f5csp2986274wra; Mon, 5 Feb 2018 13:37:33 -0800 (PST) X-Google-Smtp-Source: AH8x226SLTKqbeV8gRtnPNf7S6SWF9UnABoDz/af1j2h6KOcdBYK5AmZCzknHRu5PWprzWcqtiql X-Received: by 2002:a17:902:7889:: with SMTP id q9-v6mr206323pll.114.1517866653297; Mon, 05 Feb 2018 13:37:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517866653; cv=none; d=google.com; s=arc-20160816; b=she7cwl2bYQR+DWPpCDZ5ynVr85uEqc5X0u1UOT6RsDdO5zap5FIOkq+7aup3Pio2i Yp/cKa//RUzOjrgkmeQnN9QzVDaUxKZ+FMXoNtzpoXWEN8YxXvx01zHRQhpz+AZ4JT0L 6qW52bo5bAmNozf8uKuaiDEEuOLWFuDr+LpMTrVhBwPop6B0Z+v1wXe5ZR+Uml/RHv+D 6pAJ74MVfwupOo3I0TtzdUumlBADedQFhHcm7fLkkvSr2MhAcMn0XYIvpFtCTXSPTUUA Md8nK5kAP5KTIoKk5Tc5pfR685fpwWrz23o6hk0eZ6M+1he4hfCo9wHk9JY/iNEY8+Qx uuBw== 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=3cyVTQtS2gsnh3dKdZ/S4OY9xbm352Z9R2CQmusVaec=; b=WdUbfFAhq+1255w4AXmQRm4h9bdQcPcT5Bm3mXT191LPPhTrAD+ZuwccFP6w4GjnJV VtP7ejLjToFYX0cpnNvKn2EUubcXeDbghVqvPNHPhCNgXs3EgY3hBNdWITKYaNyfzv+M sCxvqw1A0HJxUSmQS5CAb7ntwWsWLp4+UAcHtcM+DmfwDpcr8VfB0TAHwGSXbjP6Qk1g 4zj5AmyMzbY9X1oInVvThG2HMki0iyLOTvEqLehc0fSEFx55wma54QDuV+PdIkZemcrI 5L0uLP1CBECPw+hS0yEw1uMd7qwVaGC/G4oUP1Jtn6RUUfSrlKUSVRIS0cuVY6Jot9Ic vIqQ== 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 a25si541532pfl.324.2018.02.05.13.37.18; Mon, 05 Feb 2018 13:37:33 -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 S1752215AbeBEVgS (ORCPT + 99 others); Mon, 5 Feb 2018 16:36:18 -0500 Received: from mga06.intel.com ([134.134.136.31]:7162 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752179AbeBEVgM (ORCPT ); Mon, 5 Feb 2018 16:36:12 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Feb 2018 13:36:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,466,1511856000"; d="scan'208";a="201560188" Received: from theros.lm.intel.com (HELO linux.intel.com) ([10.232.112.164]) by fmsmga006.fm.intel.com with ESMTP; 05 Feb 2018 13:35:43 -0800 Date: Mon, 5 Feb 2018 14:35:44 -0700 From: Ross Zwisler To: Dan Williams Cc: Ross Zwisler , Colin King , linux-nvdimm@lists.01.org, kernel-janitors@vger.kernel.org, Linux Kernel Mailing List Subject: Re: [PATCH] libnvdimm: remove redundant assignment to pointer 'dev' Message-ID: <20180205213544.GA30855@linux.intel.com> References: <20180205140852.14110-1-colin.king@canonical.com> <20180205182039.GA7891@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 10:44:07AM -0800, Dan Williams wrote: > On Mon, Feb 5, 2018 at 10:20 AM, Ross Zwisler > wrote: > > 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. > > > > No we wouldn't crash. We're just calculating the address, not > de-referencing a NULL pointer. Ah, yep, you're right of course. This is exactly how offsetof() is implemented in some architectures. Thanks.