From patchwork Sat Jun 24 16:02:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 9807805 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 9BB336038C for ; Sat, 24 Jun 2017 16:03:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C6C628773 for ; Sat, 24 Jun 2017 16:03:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 595B52877A; Sat, 24 Jun 2017 16:03:12 +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 A80FE28773 for ; Sat, 24 Jun 2017 16:03:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751436AbdFXQDJ (ORCPT ); Sat, 24 Jun 2017 12:03:09 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:36604 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751369AbdFXQDI (ORCPT ); Sat, 24 Jun 2017 12:03:08 -0400 Received: by mail-wr0-f193.google.com with SMTP id 77so19974649wrb.3 for ; Sat, 24 Jun 2017 09:03:07 -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=Scr+cj89nwBypo7qKw0vkp9itAcHF9ece1Rt/ry5CDw=; b=bxflwp3ZZghv71IcW0D1UnLmYN15J53GM3/8oSm9nkxsdXSL5BJ8TxAJ2UYbFIRDoP KuN6BOWFP1jt+t2B850Di7tfo+bgiPQgytw3SBYz9caia/ULu60bJgz5CXubGuJnk+ls Tml0qDd6eKHtn8/h9mPJ4Gp60Ahvir6sudhhhdNC9gRDNnwbsJym9pujh3yQoBeBVimN ZlIPmGqwjt9OeoXtVrNpn8s166H2wnG1UjFAKEh03rRfKCIMRThLC+QUOT/qRfbjjxq8 wUEm7nXNZ/C/r9tNMA5ng7U51BfRT0jeRRpOP0H3im/GMiR1WM+pKM9FZAfaB4PlSWn2 YdGA== 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=Scr+cj89nwBypo7qKw0vkp9itAcHF9ece1Rt/ry5CDw=; b=b0ivn2PDSTb77Cz2cnVYQFFBHj7xCnP1ruediIS8hve6dervsaB4Plha2D+S7/m5H3 +sMwsKtU95xUume/WwPrUaOqRgLU7wHao9OlyTOEEFau7vas640lWgiNBvfRGoxYKJo8 CCuAQsxAN1FNxFuiGWb1Siv4ADoo9tFY89zQcAwEw7DWKLVMQsGFgYxtsYNeiZqRQvi0 2Dc5Zji7YjabManpfOvQ22qtwqDNII1D+AgGndE7Pum1nLUrA42cUXYBJTHjRRS0I090 qxaoJvwo9eZmZZ/AW1R6imfr6XZfMszPJ1f9E6Q2Evy3XGqr/hzRLPaHZ3uHNbAZmUTV V4lQ== X-Gm-Message-State: AKS2vOyhoHTIbWOvdQmxAy5yrnslOe2dFwwoy9gLVJpkCTWgapdloV6D 9WOnxxxeG0xBQor3 X-Received: by 10.28.145.12 with SMTP id t12mr7995762wmd.7.1498320186903; Sat, 24 Jun 2017 09:03:06 -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 n31sm9935301wrn.59.2017.06.24.09.03.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 24 Jun 2017 09:03:06 -0700 (PDT) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Cc: rjkm@metzlerbros.de, jasmin@anw.at Subject: [PATCH 2/9] [media] dvb-frontends/stv0910: Fix possible buffer overflow Date: Sat, 24 Jun 2017 18:02:54 +0200 Message-Id: <20170624160301.17710-3-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170624160301.17710-1-d.scheller.oss@gmail.com> References: <20170624160301.17710-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 --- 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 8cb4b30f3a81..a5eac1a3a048 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -680,6 +680,7 @@ static int GetBitErrorRateS(struct stv *state, u32 *BERNumerator, static u32 DVBS2_nBCH(enum DVBS2_ModCod ModCod, 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, */ @@ -712,7 +713,7 @@ static u32 DVBS2_nBCH(enum DVBS2_ModCod ModCod, enum DVBS2_FECType FECType) if (ModCod >= DVBS2_QPSK_1_4 && ModCod <= DVBS2_32APSK_9_10 && FECType <= DVBS2_16K) - return nBCH[FECType][ModCod]; + return nBCH[ModCod][FECType]; return 64800; }