mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
To: Wang YanQing <udknight@gmail.com>
Cc: mchehab@osg.samsung.com, linux-media@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [media] soc_camera: soc_camera_pdrv_probe: fix potential NULL pointer dereference
Date: Wed, 16 Sep 2015 17:08:06 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.64.1509161707381.1783@axis700.grange> (raw)
In-Reply-To: <20150916150003.GA2195@udknight>

On Wed, 16 Sep 2015, Wang YanQing wrote:

> Move dereference of sdesc after NULL pointer checker.
> 
> Signed-off-by: Wang YanQing <udknight@gmail.com>
> ---
>  drivers/media/platform/soc_camera/soc_camera.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c
> index 9087fed..53b153d 100644
> --- a/drivers/media/platform/soc_camera/soc_camera.c
> +++ b/drivers/media/platform/soc_camera/soc_camera.c
> @@ -2187,13 +2187,14 @@ static int soc_camera_video_start(struct soc_camera_device *icd)
>  static int soc_camera_pdrv_probe(struct platform_device *pdev)
>  {
>  	struct soc_camera_desc *sdesc = pdev->dev.platform_data;
> -	struct soc_camera_subdev_desc *ssdd = &sdesc->subdev_desc;
> +	struct soc_camera_subdev_desc *ssdd;

NAK. This isn't a dereference. This is just an address calculation.

Thanks
Guennadi

>  	struct soc_camera_device *icd;
>  	int ret;
>  
>  	if (!sdesc)
>  		return -EINVAL;
>  
> +	ssdd = &sdesc->subdev_desc;
>  	icd = devm_kzalloc(&pdev->dev, sizeof(*icd), GFP_KERNEL);
>  	if (!icd)
>  		return -ENOMEM;
> -- 
> 1.8.5.6.2.g3d8a54e.dirty
> 

      reply	other threads:[~2015-09-16 15:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-16 15:00 Wang YanQing
2015-09-16 15:08 ` Guennadi Liakhovetski [this message]

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=Pine.LNX.4.64.1509161707381.1783@axis700.grange \
    --to=g.liakhovetski@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    --cc=udknight@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®