All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Neuling <mikey@neuling.org>
To: Maninder Singh <maninder1.s@samsung.com>
Cc: imunsie@au1.ibm.com, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, pankaj.m@samsung.com
Subject: Re: [PATCH 1/1] cxl/vphb.c: Use phb pointer after NULL check
Date: Mon, 29 Jun 2015 20:43:37 +1000	[thread overview]
Message-ID: <1435574617.11963.0.camel@neuling.org> (raw)
In-Reply-To: <1435574111-45617-1-git-send-email-maninder1.s@samsung.com>

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)

WARNING: multiple messages have this Message-ID (diff)
From: Michael Neuling <mikey@neuling.org>
To: Maninder Singh <maninder1.s@samsung.com>
Cc: imunsie@au1.ibm.com, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, pankaj.m@samsung.com
Subject: Re: [PATCH 1/1] cxl/vphb.c: Use phb pointer after NULL check
Date: Mon, 29 Jun 2015 20:43:37 +1000	[thread overview]
Message-ID: <1435574617.11963.0.camel@neuling.org> (raw)
In-Reply-To: <1435574111-45617-1-git-send-email-maninder1.s@samsung.com>

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 <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(-)
> 
> 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)


  reply	other threads:[~2015-06-29 10:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2015-06-29 10:43   ` Michael Neuling
2015-06-30  3:27 ` Ian Munsie
2015-07-07 10:38 ` [1/1] " Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435574617.11963.0.camel@neuling.org \
    --to=mikey@neuling.org \
    --cc=imunsie@au1.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maninder1.s@samsung.com \
    --cc=pankaj.m@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.