public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Anatolij Gustschin <agust@denx.de>
To: Wei Yongjun <weiyj.lk@gmail.com>
Cc: g.liakhovetski@gmx.de, mchehab@redhat.com,
	yongjun_wei@trendmicro.com.cn, linux-media@vger.kernel.org
Subject: Re: [PATCH -next] [media] mt9v022: fix potential NULL pointer dereference in mt9v022_probe()
Date: Thu, 29 Nov 2012 09:24:19 +0100	[thread overview]
Message-ID: <20121129092419.06fd4a8a@wker> (raw)
In-Reply-To: <CAPgLHd_6U7mMeU5r6Axc9WmpUhO1+fv5vnWXVau19zTC_qdz=g@mail.gmail.com>

On Wed, 28 Nov 2012 21:56:15 -0500
Wei Yongjun <weiyj.lk@gmail.com> wrote:

> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> The dereference to 'icl' should be moved below the NULL test.
> 
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Acked-by: Anatolij Gustschin <agust@denx.de>

> ---
>  drivers/media/i2c/soc_camera/mt9v022.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/soc_camera/mt9v022.c b/drivers/media/i2c/soc_camera/mt9v022.c
> index d40a885..7509802 100644
> --- a/drivers/media/i2c/soc_camera/mt9v022.c
> +++ b/drivers/media/i2c/soc_camera/mt9v022.c
> @@ -875,7 +875,7 @@ static int mt9v022_probe(struct i2c_client *client,
>  	struct mt9v022 *mt9v022;
>  	struct soc_camera_link *icl = soc_camera_i2c_to_link(client);
>  	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
> -	struct mt9v022_platform_data *pdata = icl->priv;
> +	struct mt9v022_platform_data *pdata;
>  	int ret;
>  
>  	if (!icl) {
> @@ -893,6 +893,7 @@ static int mt9v022_probe(struct i2c_client *client,
>  	if (!mt9v022)
>  		return -ENOMEM;
>  
> +	pdata = icl->priv;
>  	v4l2_i2c_subdev_init(&mt9v022->subdev, client, &mt9v022_subdev_ops);
>  	v4l2_ctrl_handler_init(&mt9v022->hdl, 6);
>  	v4l2_ctrl_new_std(&mt9v022->hdl, &mt9v022_ctrl_ops,

      reply	other threads:[~2012-11-29  8:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-29  2:56 [PATCH -next] [media] mt9v022: fix potential NULL pointer dereference in mt9v022_probe() Wei Yongjun
2012-11-29  8:24 ` Anatolij Gustschin [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=20121129092419.06fd4a8a@wker \
    --to=agust@denx.de \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    --cc=weiyj.lk@gmail.com \
    --cc=yongjun_wei@trendmicro.com.cn \
    /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