public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Antti Palosaari <crope@iki.fi>
To: HoP <jpetrous@gmail.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATH v2] cxd2820r: fix possible out-of-array lookup
Date: Fri, 29 Jul 2011 15:54:42 +0300	[thread overview]
Message-ID: <4E32AD92.8060500@iki.fi> (raw)
In-Reply-To: <CAJbz7-0BNRvKb82fhcvZf63hXp-RXV+WT4uX0h9_zaDPfTPgiA@mail.gmail.com>

On 07/29/2011 09:57 AM, HoP wrote:
> When I2C_WRITE is used the msg[] array contains one element only.
> Don't access msg[1] in that case. Also moved rest of msg2[1]
> setting to be used only if needed.
> 
> Signed-off-by: Honza Petrous <jpetrous@smartimp.cz>
Acked-by: Antti Palosaari <crope@iki.fi>

> 
> ---
> 
> diff -r ae517614bf00 drivers/media/dvb/frontends/cxd2820r_core.c
> --- a/drivers/media/dvb/frontends/cxd2820r_core.c	Thu Jul 28 15:44:49 2011 +0200
> +++ b/drivers/media/dvb/frontends/cxd2820r_core.c	Thu Jul 28 16:20:17 2011 +0200
> @@ -747,12 +747,7 @@ static int cxd2820r_tuner_i2c_xfer(struc
>  			.flags = 0,
>  			.len = sizeof(obuf),
>  			.buf = obuf,
> -		}, {
> -			.addr = priv->cfg.i2c_address,
> -			.flags = I2C_M_RD,
> -			.len = msg[1].len,
> -			.buf = msg[1].buf,
> -		}
> +		},
>  	};
> 
>  	obuf[0] = 0x09;
> @@ -760,6 +755,11 @@ static int cxd2820r_tuner_i2c_xfer(struc
>  	if (num == 2) { /* I2C read */
>  		obuf[1] = (msg[0].addr << 1) | I2C_M_RD; /* I2C RD flag */
>  		msg2[0].len = sizeof(obuf) - 1; /* maybe HW bug ? */
> +
> +		msg2[1].addr = priv->cfg.i2c_address,
> +		msg2[1].flags = I2C_M_RD,
> +		msg2[1].len = msg[1].len,
> +		msg2[1].buf = msg[1].buf,
>  	}
>  	memcpy(&obuf[2], msg[0].buf, msg[0].len);


-- 
http://palosaari.fi/

  reply	other threads:[~2011-07-29 12:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-29  6:57 [PATH v2] cxd2820r: fix possible out-of-array lookup HoP
2011-07-29 12:54 ` Antti Palosaari [this message]
2011-08-07 18:08   ` [PATCH] CXD2820R: Replace i2c message translation with repeater gate control Steve Kerrison
2011-08-08 23:16     ` Antti Palosaari
2011-08-09 10:16       ` [PATCH v2] " Steve Kerrison
2011-08-09 10:45         ` Antti Palosaari
2011-08-21 22:59   ` [PATH v2] cxd2820r: fix possible out-of-array lookup Antti Palosaari

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=4E32AD92.8060500@iki.fi \
    --to=crope@iki.fi \
    --cc=jpetrous@gmail.com \
    --cc=linux-media@vger.kernel.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