Linux Media Controller development
 help / color / mirror / Atom feed
From: Wang YanQing <udknight@gmail.com>
To: mchehab@osg.samsung.com
Cc: g.liakhovetski@gmx.de, linux-media@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] [media] soc_camera: soc_camera_pdrv_probe: fix potential NULL pointer dereference
Date: Wed, 16 Sep 2015 23:00:03 +0800	[thread overview]
Message-ID: <20150916150003.GA2195@udknight> (raw)

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

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-16 15:00 Wang YanQing [this message]
2015-09-16 15:08 ` [PATCH] [media] soc_camera: soc_camera_pdrv_probe: fix potential NULL pointer dereference Guennadi Liakhovetski

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