All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATH v2] cxd2820r: fix possible out-of-array lookup
@ 2011-07-29  6:57 HoP
  2011-07-29 12:54 ` Antti Palosaari
  0 siblings, 1 reply; 7+ messages in thread
From: HoP @ 2011-07-29  6:57 UTC (permalink / raw)
  To: linux-media, Antti

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>

---

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);

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-08-21 22:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-29  6:57 [PATH v2] cxd2820r: fix possible out-of-array lookup HoP
2011-07-29 12:54 ` Antti Palosaari
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

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.