Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753040AbbF2KgA (ORCPT ); Mon, 29 Jun 2015 06:36:00 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:40017 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752120AbbF2Kfx (ORCPT ); Mon, 29 Jun 2015 06:35:53 -0400 X-AuditID: cbfee68f-f793b6d000005f66-0c-55911f876372 From: Maninder Singh To: imunsie@au1.ibm.com, mikey@neuling.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: pankaj.m@samsung.com, Maninder Singh Subject: [PATCH 1/1] cxl/vphb.c: Use phb pointer after NULL check Date: Mon, 29 Jun 2015 16:05:11 +0530 Message-id: <1435574111-45617-1-git-send-email-maninder1.s@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDLMWRmVeSWpSXmKPExsWyRsSkSrddfmKowaHnBhbLG54yW1zeNYfN 4vf3f6wWh+e3sVgs7ZvGbHHvzVYmBzaPN8+XMHqcn7GQ0eP7wmZGj74tqxg9Pm+SC2CN4rJJ Sc3JLEst0rdL4Mo4v/cre0ETe0Xr2zesDYyvWLsYOTkkBEwkug+tYISwxSQu3FvP1sXIxSEk sJRR4uiyFywwRYdv7YdKLGKU6H56Esr5ySixefkDsHY2AT2JVbv2AHVwcIgIZEqsWS8PYjIL OElM/6oHUiEs4Chx48ZZJhCbRUBVYvK8LrD5vALuEn0r7rGClEsIKEjMmWQDMl1C4DubxJmD bxkh6gUkvk0+xAJRIyux6QAzxGmSEgdX3GCZwCi4gJFhFaNoakFyQXFSepGxXnFibnFpXrpe cn7uJkZgoJ7+96x/B+PdA9aHGAU4GJV4eBd8nBAqxJpYVlyZe4jRFGjDRGYp0eR8YDzklcQb GpsZWZiamBobmVuaKYnzLpT6GSwkkJ5YkpqdmlqQWhRfVJqTWnyIkYmDU6qB0e1Wg6pV7n+O NM0zF523GixbkrZ5aUnSG2/9987dD51rEvVOrat4Fyvf48sk/9OH18ZMi+ljz5PdX06+OTYn 00Xebo6eGven8rlFqS8kspfzFL5Q1JQsW2uQvqKge5Oxj8615zcXvsuQSI5hO73/7eHlTyZt bmE/9HUxy2KZszuT8ifUJW/RVWIpzkg01GIuKk4EAIfOuQdPAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpjkeLIzCtJLcpLzFFi42I5/e+xgG67/MRQg2v71SyWNzxltri8aw6b xe/v/1gtDs9vY7FY2jeN2eLem61MDmweb54vYfQ4P2Mho8f3hc2MHn1bVjF6fN4kF8Aa1cBo k5GamJJapJCal5yfkpmXbqvkHRzvHG9qZmCoa2hpYa6kkJeYm2qr5OIToOuWmQN0gpJCWWJO KVAoILG4WEnfDtOE0BA3XQuYxghd35AguB4jAzSQsIYx4/zer+wFTewVrW/fsDYwvmLtYuTk kBAwkTh8az8bhC0mceHeeiCbi0NIYBGjRPfTk1DOT0aJzcsfMIJUsQnoSazatYeli5GDQ0Qg U2LNenkQk1nASWL6Vz2QCmEBR4kbN84ygdgsAqoSk+d1sYDYvALuEn0r7rGClEsIKEjMmWQz gZF7ASPDKkbR1ILkguKk9FwjveLE3OLSvHS95PzcTYzgOHgmvYNxVYPFIUYBDkYlHl6HFxNC hVgTy4orcw8xSnAwK4nwXt4MFOJNSaysSi3Kjy8qzUktPsRoCrR8IrOUaHI+MEbzSuINjU3M TY1NLU0sTMwslcR5T+b7hAoJpCeWpGanphakFsH0MXFwSjUwNjBsuaGjdH6uwduAK+uadpsv vZystepHHue2SQc4fxfdU+223yqnx3Bz6//VG60t/Y7ULToh+Kbz2D72X8z9u1JZrnz12HrS WaD0me9pZSHt3ZtZrG9PSXR93XiM2d9vp0bexf8K30SVtJ2Xsu4psJl+Ip5TaMUT7+h7FQq+ iY5reh8wdfgwKrEUZyQaajEXFScCAJZlUImZAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1114 Lines: 34 static Anlaysis detected below error:- (error) Possible null pointer dereference: phb So, Use phb after NULL check. Signed-off-by: Maninder Singh --- 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) -- 1.7.9.5 -- 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/