linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
To: Sachin Kamat <sachin.kamat@linaro.org>
Cc: linux-media@vger.kernel.org, s.nawrocki@samsung.com, patches@linaro.org
Subject: Re: [PATCH 1/1] [media] s5p-fimc: Fix potential NULL pointer dereference
Date: Sat, 20 Oct 2012 12:10:24 +0200	[thread overview]
Message-ID: <50827890.9090201@gmail.com> (raw)
In-Reply-To: <1350128479-9619-1-git-send-email-sachin.kamat@linaro.org>

Hi Sachin,

On 10/13/2012 01:41 PM, Sachin Kamat wrote:
> 'fimc' was being dereferenced before the NULL check.
> Moved it to after the check.
>
> Signed-off-by: Sachin Kamat<sachin.kamat@linaro.org>
> ---
>   drivers/media/platform/s5p-fimc/fimc-mdevice.c |    6 ++++--
>   1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/s5p-fimc/fimc-mdevice.c b/drivers/media/platform/s5p-fimc/fimc-mdevice.c
> index 80ada58..61fab00 100644
> --- a/drivers/media/platform/s5p-fimc/fimc-mdevice.c
> +++ b/drivers/media/platform/s5p-fimc/fimc-mdevice.c
> @@ -343,7 +343,7 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd)
>   static int fimc_register_callback(struct device *dev, void *p)
>   {
>   	struct fimc_dev *fimc = dev_get_drvdata(dev);
> -	struct v4l2_subdev *sd =&fimc->vid_cap.subdev;
> +	struct v4l2_subdev *sd;
>   	struct fimc_md *fmd = p;
>   	int ret = 0;
>
> @@ -353,6 +353,7 @@ static int fimc_register_callback(struct device *dev, void *p)
>   	if (fimc->pdev->id<  0 || fimc->pdev->id>= FIMC_MAX_DEVS)
>   		return 0;
>
> +	sd =&fimc->vid_cap.subdev;
>   	fimc->pipeline_ops =&fimc_pipeline_ops;
>   	fmd->fimc[fimc->pdev->id] = fimc;
>   	sd->grp_id = FIMC_GROUP_ID;
> @@ -369,7 +370,7 @@ static int fimc_register_callback(struct device *dev, void *p)
>   static int fimc_lite_register_callback(struct device *dev, void *p)
>   {
>   	struct fimc_lite *fimc = dev_get_drvdata(dev);
> -	struct v4l2_subdev *sd =&fimc->subdev;
> +	struct v4l2_subdev *sd;

Thank you for the patch. May I ask you to remove sd instead and to
replace sd with fimc->subdev ? There are just two references of
sd below.

>   	struct fimc_md *fmd = p;
>   	int ret;
>
> @@ -379,6 +380,7 @@ static int fimc_lite_register_callback(struct device *dev, void *p)
>   	if (fimc->index>= FIMC_LITE_MAX_DEVS)
>   		return 0;
>
> +	sd =&fimc->subdev;
>   	fimc->pipeline_ops =&fimc_pipeline_ops;
>   	fmd->fimc_lite[fimc->index] = fimc;
>   	sd->grp_id = FLITE_GROUP_ID;

Thanks,
Sylwester

      reply	other threads:[~2012-10-20 10:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-13 11:41 [PATCH 1/1] [media] s5p-fimc: Fix potential NULL pointer dereference Sachin Kamat
2012-10-20 10:10 ` Sylwester Nawrocki [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=50827890.9090201@gmail.com \
    --to=sylvester.nawrocki@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=patches@linaro.org \
    --cc=s.nawrocki@samsung.com \
    --cc=sachin.kamat@linaro.org \
    /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;
as well as URLs for NNTP newsgroup(s).