From patchwork Mon Jul 3 17:20:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 9823757 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 70F0060237 for ; Mon, 3 Jul 2017 17:21:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56C2627F88 for ; Mon, 3 Jul 2017 17:21:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B56627FB1; Mon, 3 Jul 2017 17:21:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7E8928624 for ; Mon, 3 Jul 2017 17:21:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755503AbdGCRVM (ORCPT ); Mon, 3 Jul 2017 13:21:12 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:35524 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755472AbdGCRVL (ORCPT ); Mon, 3 Jul 2017 13:21:11 -0400 Received: by mail-wr0-f194.google.com with SMTP id z45so45400036wrb.2 for ; Mon, 03 Jul 2017 10:21:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=639/kPObloywCKM/O4NHVEqynhuzWFACvTR92HHn0jU=; b=eC4cEHBaJL2KTWxsF1IYZSsJa2qDgGgQFYzyVf67JAPSicssX5bhsnLo05JruZbxXb phKLCpYy82M6EhF1p1wuxSgDD3/O4XgxXsTtZyMYn6lUDlextYBfkjiXfzDgabfoLOck cju9YBP4kQ/dBwLraG4j8zqdjHHQbpTfTWWSjZhJ9ZTRCrbXVaEoHA5nwPk9CrJ0vg3k hBiBTWy0L+xRCqi0CbnYd8+qMEZFYq3+96LqR3m95LrxnCOm6aIVrt9sko9MlZuHbtKM Rg+NRMLwXLqPaUMkNUZaZnB0SLW89CQnFnTDbW6Ur2xd9l9g0vEKiP4YOiVMfgBKaxzr vr+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=639/kPObloywCKM/O4NHVEqynhuzWFACvTR92HHn0jU=; b=Rw5a1hn+Mr7VNo/ELnkpwPzbV9Mtvr647BVbtJJ9FDnPyWJrnj6dcMbyEjLdoY+HwW j9ev+8+238LDHMX3nlZ7LDfuCkHtLL26kftxr4hci5yvRnsEBqlzThixtt+LjlJwwAAU NQ7xD9//W73P8lIgBzEvm9lIaKUX4TwDMfjtJCj+22deO0xGj2lEtXUkCayu7lzZw5OP aqUjRlI9bNlrgNAKHaoo1jZtfNqNsQGSbgrnRkR8gJa0InPtrTsj2ROdb0jymQba3z+1 kZFEz7ZLaNfmRlVFEHxXRul9DYUP11DoeVsH8X29Jj/rEY++o14Bqdze8rrpWN2Yj0q/ Rq/Q== X-Gm-Message-State: AKS2vOxYYsmFsXRp1jeje8QbwWvmsrUsIY4RpfAaoXpcRi+3ACapVqqF /LeSUWDErMPTU5Y9 X-Received: by 10.223.168.48 with SMTP id l45mr33962163wrc.94.1499102469750; Mon, 03 Jul 2017 10:21:09 -0700 (PDT) Received: from dvbdev.wuest.de (ip-37-24-178-151.hsi14.unitymediagroup.de. [37.24.178.151]) by smtp.gmail.com with ESMTPSA id x21sm17350309wme.24.2017.07.03.10.21.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 03 Jul 2017 10:21:09 -0700 (PDT) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Cc: jasmin@anw.at, rjkm@metzlerbros.de Subject: [PATCH v3 02/10] [media] dvb-frontends/stv0910: Fix possible buffer overflow Date: Mon, 3 Jul 2017 19:20:55 +0200 Message-Id: <20170703172104.27283-3-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170703172104.27283-1-d.scheller.oss@gmail.com> References: <20170703172104.27283-1-d.scheller.oss@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Daniel Scheller 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 Signed-off-by: Daniel Scheller Tested-by: Richard Scobie --- 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 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; }