diff options
author | Daniel Scheller <d.scheller@gmx.net> | 2017-07-03 20:20:55 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-07-20 19:57:59 +0300 |
commit | 13c81489622b866f4b4fcbd51707ab4c09e1c8db (patch) | |
tree | 4d6d90948eb7a5d55b9599d45848841aff3e8b69 /drivers/media/dvb-frontends/stv0910.c | |
parent | cd21b334943719f880e707eb91895fc916a88000 (diff) | |
download | linux-13c81489622b866f4b4fcbd51707ab4c09e1c8db.tar.xz |
media: dvb-frontends/stv0910: Fix possible buffer overflow
Fixes smatch error:
drivers/media/dvb-frontends/stv0910.c:715 dvbs2_nbch() error: buffer overflow 'nbch[fectype]' 2 <= 28
Also, fixes the nbch array table by adding the DUMMY_PLF element at the top
to match the enums (table element order was off by one before).
Patch sent upstream aswell.
Cc: Ralph Metzler <rjkm@metzlerbros.de>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Richard Scobie <r.scobie@clear.net.nz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/dvb-frontends/stv0910.c')
-rw-r--r-- | drivers/media/dvb-frontends/stv0910.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index 9dfcaf5e067f..85439d3b725e 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -671,6 +671,7 @@ static int get_bit_error_rate_s(struct stv *state, u32 *bernumerator, static u32 dvbs2_nbch(enum dvbs2_mod_cod mod_cod, enum dvbs2_fectype fectype) { static u32 nbch[][2] = { + { 0, 0}, /* DUMMY_PLF */ {16200, 3240}, /* QPSK_1_4, */ {21600, 5400}, /* QPSK_1_3, */ {25920, 6480}, /* QPSK_2_5, */ @@ -703,7 +704,7 @@ static u32 dvbs2_nbch(enum dvbs2_mod_cod mod_cod, enum dvbs2_fectype fectype) if (mod_cod >= DVBS2_QPSK_1_4 && mod_cod <= DVBS2_32APSK_9_10 && fectype <= DVBS2_16K) - return nbch[fectype][mod_cod]; + return nbch[mod_cod][fectype]; return 64800; } |