diff options
author | Saso Slavicic <saso.linux@astim.si> | 2016-07-13 11:56:22 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-07-13 11:56:22 -0300 |
commit | cd82982179cecc1832ae83ef3cc6ba5100fe964d (patch) | |
tree | d477487bf958103d14ce66450fefee2769a88881 /drivers/media/dvb-frontends/ascot2e.c | |
parent | babbf09185b53c9bd7c63e6059fc9611e9d72aac (diff) |
[media] ascot2e: Fix I2C message size check
Tuning a card with Sony ASCOT2E produces the following error:
kernel: i2c i2c-9: wr reg=0006: len=11 is too big!
MAX_WRITE_REGSIZE is defined as 10, buf[MAX_WRITE_REGSIZE + 1] buffer is
used in ascot2e_write_regs().
The problem is that exactly 10 bytes are written in ascot2e_set_params():
/* Set BW_OFFSET (0x0F) value from parameter table */
data[9] = ascot2e_sett[tv_system].bw_offset;
ascot2e_write_regs(priv, 0x06, data, 10);
The test in write_regs is as follows:
if (len + 1 >= sizeof(buf))
10 + 1 = 11 and that would be exactly the size of buf. Since 10 bytes +
buf[0] = reg would seem to fit into buf[], this shouldn't be an error.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/dvb-frontends/ascot2e.c')
-rw-r--r-- | drivers/media/dvb-frontends/ascot2e.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/dvb-frontends/ascot2e.c b/drivers/media/dvb-frontends/ascot2e.c index f770f6a2c987..8cc8c4597b6a 100644 --- a/drivers/media/dvb-frontends/ascot2e.c +++ b/drivers/media/dvb-frontends/ascot2e.c @@ -132,7 +132,7 @@ static int ascot2e_write_regs(struct ascot2e_priv *priv, } }; - if (len + 1 >= sizeof(buf)) { + if (len + 1 > sizeof(buf)) { dev_warn(&priv->i2c->dev,"wr reg=%04x: len=%d is too big!\n", reg, len + 1); return -E2BIG; |