summaryrefslogtreecommitdiff
path: root/drivers/media/dvb-frontends
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-11-05 09:42:22 -0200
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-11-05 09:42:22 -0200
commit667c952e7191ffb0a2703c8e173b0d5f0231a764 (patch)
tree7f1f65e6053d451d7d4b68f3a79a7ce5b7243362 /drivers/media/dvb-frontends
parentb9f62ffe05e4019da205d6fec244226b191c5242 (diff)
[media] cx22700: Fix potential buffer overflow
As new FEC types were added, we need a check to avoid overflows: drivers/media/dvb-frontends/cx22700.c:172 cx22700_set_tps() error: buffer overflow 'fec_tab' 6 <= 6 drivers/media/dvb-frontends/cx22700.c:173 cx22700_set_tps() error: buffer overflow 'fec_tab' 6 <= 6 Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/dvb-frontends')
-rw-r--r--drivers/media/dvb-frontends/cx22700.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/media/dvb-frontends/cx22700.c b/drivers/media/dvb-frontends/cx22700.c
index 3d399d9a6343..86563260d0f2 100644
--- a/drivers/media/dvb-frontends/cx22700.c
+++ b/drivers/media/dvb-frontends/cx22700.c
@@ -169,6 +169,9 @@ static int cx22700_set_tps(struct cx22700_state *state,
cx22700_writereg (state, 0x04, val);
+ if (p->code_rate_HP - FEC_1_2 >= sizeof(fec_tab) ||
+ p->code_rate_LP - FEC_1_2 >= sizeof(fec_tab))
+ return -EINVAL;
val = fec_tab[p->code_rate_HP - FEC_1_2] << 3;
val |= fec_tab[p->code_rate_LP - FEC_1_2];