linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Scheller <d.scheller.oss@gmail.com>
To: linux-media@vger.kernel.org, mchehab@kernel.org,
	mchehab@s-opensource.com
Cc: rjkm@metzlerbros.de, jasmin@anw.at
Subject: [PATCH v2 02/10] [media] dvb-frontends/stv0910: Fix possible buffer overflow
Date: Fri, 30 Jun 2017 22:50:58 +0200	[thread overview]
Message-ID: <20170630205106.1268-3-d.scheller.oss@gmail.com> (raw)
In-Reply-To: <20170630205106.1268-1-d.scheller.oss@gmail.com>

From: Daniel Scheller <d.scheller@gmx.net>

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>
---
 drivers/media/dvb-frontends/stv0910.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c
index 2f25bad7f7b8..5a5d190298ea 100644
--- a/drivers/media/dvb-frontends/stv0910.c
+++ b/drivers/media/dvb-frontends/stv0910.c
@@ -676,6 +676,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, */
@@ -708,7 +709,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;
 }
 
-- 
2.13.0

  parent reply	other threads:[~2017-06-30 20:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-30 20:50 [PATCH v2 00/10] STV0910/STV6111 drivers, ddbridge CineS2 V7 support Daniel Scheller
2017-06-30 20:50 ` [PATCH v2 01/10] [media] dvb-frontends: add ST STV0910 DVB-S/S2 demodulator frontend driver Daniel Scheller
2017-07-03 22:01   ` kbuild test robot
2017-07-04  5:44     ` Daniel Scheller
2017-06-30 20:50 ` Daniel Scheller [this message]
2017-06-30 20:50 ` [PATCH v2 03/10] [media] dvb-frontends/stv0910: add multistream (ISI) and PLS capabilities Daniel Scheller
2017-06-30 20:51 ` [PATCH v2 04/10] [media] dvb-frontends/stv0910: Add demod-only signal strength reporting Daniel Scheller
2017-06-30 20:51 ` [PATCH v2 05/10] [media] dvb-frontends/stv0910: Add missing set_frontend fe-op Daniel Scheller
2017-06-30 20:51 ` [PATCH v2 06/10] [media] dvb-frontends: add ST STV6111 DVB-S/S2 tuner frontend driver Daniel Scheller
2017-06-30 20:51 ` [PATCH v2 07/10] [media] ddbridge: return stv09xx id in port_has_stv0900_aa() Daniel Scheller
2017-06-30 20:51 ` [PATCH v2 08/10] [media] ddbridge: support for CineS2 V7(A) and DuoFlex S2 V4 hardware Daniel Scheller
2017-06-30 20:51 ` [PATCH v2 09/10] [media] ddbridge: stv0910 single demod mode module option Daniel Scheller
2017-06-30 20:51 ` [PATCH v2 10/10] [media] MAINTAINERS: add entries for stv0910 and stv6111 Daniel Scheller
2017-07-01  4:19 ` [PATCH v2 00/10] STV0910/STV6111 drivers, ddbridge CineS2 V7 support Richard Scobie
2017-07-08  0:08 ` Jasmin J.

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=20170630205106.1268-3-d.scheller.oss@gmail.com \
    --to=d.scheller.oss@gmail.com \
    --cc=jasmin@anw.at \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mchehab@s-opensource.com \
    --cc=rjkm@metzlerbros.de \
    /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;
as well as URLs for NNTP newsgroup(s).