All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: Sachin Kamat <sachin.kamat@linaro.org>
Cc: linux-media@vger.kernel.org, patches@linaro.org
Subject: Re: [PATCH 1/1] [media] exynos4-is: Fix potential null pointer dereferencing
Date: Mon, 15 Apr 2013 17:21:47 +0200	[thread overview]
Message-ID: <516C1B0B.4010806@samsung.com> (raw)
In-Reply-To: <1366027438-4560-1-git-send-email-sachin.kamat@linaro.org>

Hi Sachin,

On 04/15/2013 02:03 PM, Sachin Kamat wrote:
> If fimc->drv_data is NULL, then fimc->drv_data->num_entities would
> cause NULL pointer dereferencing.
> While at it also remove the check for fimc->id being negative as 'id' is
> unsigned variable and can't be less than 0.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/media/platform/exynos4-is/fimc-core.c |    7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/exynos4-is/fimc-core.c b/drivers/media/platform/exynos4-is/fimc-core.c
> index f25807d..d388832 100644
> --- a/drivers/media/platform/exynos4-is/fimc-core.c
> +++ b/drivers/media/platform/exynos4-is/fimc-core.c
> @@ -953,10 +953,9 @@ static int fimc_probe(struct platform_device *pdev)
>  		fimc->drv_data = fimc_get_drvdata(pdev);
>  		fimc->id = pdev->id;
>  	}
> -	if (!fimc->drv_data || fimc->id >= fimc->drv_data->num_entities ||
> -	    fimc->id < 0) {
> -		dev_err(dev, "Invalid driver data or device id (%d/%d)\n",
> -			fimc->id, fimc->drv_data->num_entities);
> +	if (!fimc->drv_data || fimc->id >= fimc->drv_data->num_entities) {
> +		dev_err(dev, "Invalid driver data or device id (%d)\n",
> +			fimc->id);
>  		return -EINVAL;

Thanks for the patch. To make it more explicit I would prefer to change
id type to 'int', and to leave the check for negative value. There is
a similar issue in fimc-lite.c that could be addressed in same patch.
Could you also fix this and resend ?

Regards,
Sylwester

  reply	other threads:[~2013-04-15 15:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-15 12:03 [PATCH 1/1] [media] exynos4-is: Fix potential null pointer dereferencing Sachin Kamat
2013-04-15 15:21 ` Sylwester Nawrocki [this message]
2013-04-16  6:16   ` Sachin Kamat
2013-04-17 11:03     ` Sylwester Nawrocki
2013-04-17 11:09       ` Sachin Kamat

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=516C1B0B.4010806@samsung.com \
    --to=s.nawrocki@samsung.com \
    --cc=linux-media@vger.kernel.org \
    --cc=patches@linaro.org \
    --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 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.