Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753032AbbF2Knq (ORCPT ); Mon, 29 Jun 2015 06:43:46 -0400 Received: from ozlabs.org ([103.22.144.67]:33782 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752372AbbF2Kni convert rfc822-to-8bit (ORCPT ); Mon, 29 Jun 2015 06:43:38 -0400 Message-ID: <1435574617.11963.0.camel@neuling.org> Subject: Re: [PATCH 1/1] cxl/vphb.c: Use phb pointer after NULL check From: Michael Neuling To: Maninder Singh Cc: imunsie@au1.ibm.com, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, pankaj.m@samsung.com Date: Mon, 29 Jun 2015 20:43:37 +1000 In-Reply-To: <1435574111-45617-1-git-send-email-maninder1.s@samsung.com> References: <1435574111-45617-1-git-send-email-maninder1.s@samsung.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1280 Lines: 38 On Mon, 2015-06-29 at 16:05 +0530, Maninder Singh wrote: > static Anlaysis detected below error:- > (error) Possible null pointer dereference: phb > > So, Use phb after NULL check. > > Signed-off-by: Maninder Singh Thanks, looks good. Acked-By: Michael Neuling > --- > drivers/misc/cxl/vphb.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/misc/cxl/vphb.c b/drivers/misc/cxl/vphb.c > index b1d1983a..2eba002 100644 > --- a/drivers/misc/cxl/vphb.c > +++ b/drivers/misc/cxl/vphb.c > @@ -112,9 +112,10 @@ static int cxl_pcie_config_info(struct pci_bus *bus, unsigned int devfn, > unsigned long addr; > > phb = pci_bus_to_host(bus); > - afu = (struct cxl_afu *)phb->private_data; > if (phb == NULL) > return PCIBIOS_DEVICE_NOT_FOUND; > + afu = (struct cxl_afu *)phb->private_data; > + > if (cxl_pcie_cfg_record(bus->number, devfn) > afu->crs_num) > return PCIBIOS_DEVICE_NOT_FOUND; > if (offset >= (unsigned long)phb->cfg_data) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/