From patchwork Fri Jun 30 20:50:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 9820467 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 56B34603D7 for ; Fri, 30 Jun 2017 20:51:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4956E28066 for ; Fri, 30 Jun 2017 20:51:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3DA5728478; Fri, 30 Jun 2017 20:51:16 +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 E297628066 for ; Fri, 30 Jun 2017 20:51:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752962AbdF3UvO (ORCPT ); Fri, 30 Jun 2017 16:51:14 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:35471 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752957AbdF3UvN (ORCPT ); Fri, 30 Jun 2017 16:51:13 -0400 Received: by mail-wr0-f194.google.com with SMTP id z45so40142203wrb.2 for ; Fri, 30 Jun 2017 13:51:13 -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=NSplk03I0gMkpMSqwFEfKF5fuCpx4+YiH+E7WrEZPX8=; b=evducb/8slsgftchqYNDdipPxtrvVY2wOGq2GQbQB7Qa4S07R1WIHi1G/jlgjdFcF3 3iuOTarrQ7KPV79Cm5RR5PD92mlAByctAavXBghsvssaXLcPtK1fVV5s9R12LfrqkIxs 0r9+tf60KIPJm1kmvN9Q9uKCCanJl1Ys9lQqJ5Cx5gwsYIIFMZA6/XEYTxaLmNxNsb6T nut+sE8VhJmqTuyDq0H8RaaxR5KljCofLHandIsjJi5c4ZOM5j5vo+F2IE6JFD5+hInI 0755Qrb7VyGtYkuwdgLj3lHsxBIyEqIGaPBOqpr7BegMaA4M+4WXO5h6vF+CkAWSrdMk tu+g== 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=NSplk03I0gMkpMSqwFEfKF5fuCpx4+YiH+E7WrEZPX8=; b=UtaQM1wtlCTazZiEXSNHU72tVSP6nM5Ut4X++f1hU/jSNuKeou0wiEHi5Li5C/7jzB 1K/IC+GdQc6F7FnG2BE/G+xrY1cJLZA1oopvmuz3jvp/sdmsfi1ezc5NF8wLpJAGjm0G WZzqGQliFqrYt3gONHIbCSqTAZUoAHQoitTtgSIBIvzPg3loSU9KxZn21RpA8++2r9W7 WD5C9PQYV6ehoy0gZ+t89VQPUf09sHoV7kl29YFtT8lFAFqvzbTivDaOaH2z5tNJiq85 B+7WyRXlO9zOIFTtKZKcn5GNpXcHhxjw1wtZnlaZTD79eGeWaJ6hdR91KI16Fu79UvMi /irg== X-Gm-Message-State: AKS2vOwg8T3HeaeIZ8AMidi5W+i3t5vpIxXajN5Na2rEyoNeUXA8uDei M+SIuhOnUXAcmxuL X-Received: by 10.223.150.163 with SMTP id u32mr27722165wrb.195.1498855872354; Fri, 30 Jun 2017 13:51:12 -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 e24sm6420051wrc.35.2017.06.30.13.51.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 Jun 2017 13:51:11 -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 v2 02/10] [media] dvb-frontends/stv0910: Fix possible buffer overflow Date: Fri, 30 Jun 2017 22:50:58 +0200 Message-Id: <20170630205106.1268-3-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170630205106.1268-1-d.scheller.oss@gmail.com> References: <20170630205106.1268-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 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; }