* [PATCH 1/1] cxl/vphb.c: Use phb pointer after NULL check
@ 2015-06-29 10:35 Maninder Singh
2015-06-29 10:43 ` Michael Neuling
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Maninder Singh @ 2015-06-29 10:35 UTC (permalink / raw)
To: imunsie, mikey, linuxppc-dev, linux-kernel; +Cc: pankaj.m, Maninder Singh
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>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] cxl/vphb.c: Use phb pointer after NULL check
2015-06-29 10:35 [PATCH 1/1] cxl/vphb.c: Use phb pointer after NULL check Maninder Singh
@ 2015-06-29 10:43 ` Michael Neuling
2015-06-30 3:27 ` Ian Munsie
2015-07-07 10:38 ` [1/1] " Michael Ellerman
2 siblings, 0 replies; 4+ messages in thread
From: Michael Neuling @ 2015-06-29 10:43 UTC (permalink / raw)
To: Maninder Singh; +Cc: imunsie, linuxppc-dev, linux-kernel, pankaj.m
On Mon, 2015-06-29 at 16:05 +0530, Maninder Singh wrote:
> static Anlaysis detected below error:-
> (error) Possible null pointer dereference: phb
>=20
> So, Use phb after NULL check.
>=20
> Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Thanks, looks good.
Acked-By: Michael Neuling <mikey@neuling.org>
> ---
> drivers/misc/cxl/vphb.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>=20
> 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;
> =20
> phb =3D pci_bus_to_host(bus);
> - afu =3D (struct cxl_afu *)phb->private_data;
> if (phb =3D=3D NULL)
> return PCIBIOS_DEVICE_NOT_FOUND;
> + afu =3D (struct cxl_afu *)phb->private_data;
> +
> if (cxl_pcie_cfg_record(bus->number, devfn) > afu->crs_num)
> return PCIBIOS_DEVICE_NOT_FOUND;
> if (offset >=3D (unsigned long)phb->cfg_data)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] cxl/vphb.c: Use phb pointer after NULL check
2015-06-29 10:35 [PATCH 1/1] cxl/vphb.c: Use phb pointer after NULL check Maninder Singh
2015-06-29 10:43 ` Michael Neuling
@ 2015-06-30 3:27 ` Ian Munsie
2015-07-07 10:38 ` [1/1] " Michael Ellerman
2 siblings, 0 replies; 4+ messages in thread
From: Ian Munsie @ 2015-06-30 3:27 UTC (permalink / raw)
To: Maninder Singh; +Cc: mikey, linuxppc-dev, linux-kernel, pankaj.m
Acked-by: Ian Munsie <imunsie@au1.ibm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [1/1] cxl/vphb.c: Use phb pointer after NULL check
2015-06-29 10:35 [PATCH 1/1] cxl/vphb.c: Use phb pointer after NULL check Maninder Singh
2015-06-29 10:43 ` Michael Neuling
2015-06-30 3:27 ` Ian Munsie
@ 2015-07-07 10:38 ` Michael Ellerman
2 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2015-07-07 10:38 UTC (permalink / raw)
To: Maninder Singh, imunsie, mikey, linuxppc-dev, linux-kernel
Cc: Maninder Singh, pankaj.m
On Mon, 2015-29-06 at 10:35:11 UTC, 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 <maninder1.s@samsung.com>
> Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Applied to powerpc fixes, thanks.
https://git.kernel.org/cgit/linux/kernel/git/powerpc/linux.git/commit/?h=fixes&id=14f21189df33bc972455d6a0ed875aa68718d7fc
cheers
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-07-07 10:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-29 10:35 [PATCH 1/1] cxl/vphb.c: Use phb pointer after NULL check Maninder Singh
2015-06-29 10:43 ` Michael Neuling
2015-06-30 3:27 ` Ian Munsie
2015-07-07 10:38 ` [1/1] " Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).