Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cxl/vphb.c: Use phb pointer after NULL check

static Anlaysis detected below error:-
(error) Possible null pointer dereference: phb

So, Use phb after NULL check.

Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Maninder Singh and committed by
Michael Ellerman
14f21189 d8ea782b

+2 -1
+2 -1
drivers/misc/cxl/vphb.c
··· 112 112 unsigned long addr; 113 113 114 114 phb = pci_bus_to_host(bus); 115 - afu = (struct cxl_afu *)phb->private_data; 116 115 if (phb == NULL) 117 116 return PCIBIOS_DEVICE_NOT_FOUND; 117 + afu = (struct cxl_afu *)phb->private_data; 118 + 118 119 if (cxl_pcie_cfg_record(bus->number, devfn) > afu->crs_num) 119 120 return PCIBIOS_DEVICE_NOT_FOUND; 120 121 if (offset >= (unsigned long)phb->cfg_data)