* [PATCH] [media] soc_camera: soc_camera_pdrv_probe: fix potential NULL pointer dereference
@ 2015-09-16 15:00 Wang YanQing
2015-09-16 15:08 ` Guennadi Liakhovetski
0 siblings, 1 reply; 2+ messages in thread
From: Wang YanQing @ 2015-09-16 15:00 UTC (permalink / raw)
To: mchehab; +Cc: g.liakhovetski, linux-media, linux-kernel
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;
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] [media] soc_camera: soc_camera_pdrv_probe: fix potential NULL pointer dereference
2015-09-16 15:00 [PATCH] [media] soc_camera: soc_camera_pdrv_probe: fix potential NULL pointer dereference Wang YanQing
@ 2015-09-16 15:08 ` Guennadi Liakhovetski
0 siblings, 0 replies; 2+ messages in thread
From: Guennadi Liakhovetski @ 2015-09-16 15:08 UTC (permalink / raw)
To: Wang YanQing; +Cc: mchehab, linux-media, linux-kernel
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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-16 15:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-16 15:00 [PATCH] [media] soc_camera: soc_camera_pdrv_probe: fix potential NULL pointer dereference Wang YanQing
2015-09-16 15:08 ` Guennadi Liakhovetski
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).