From patchwork Tue Aug 11 19:15:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 6994371 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6AC04C05AC for ; Tue, 11 Aug 2015 19:19:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A1B2220609 for ; Tue, 11 Aug 2015 19:19:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DA55C20574 for ; Tue, 11 Aug 2015 19:19:07 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZPF33-0005Ee-5R; Tue, 11 Aug 2015 19:17:21 +0000 Received: from 177.43.144.154.dynamic.adsl.gvt.net.br ([177.43.144.154] helo=smtp.w2.samsung.com) by bombadil.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZPF30-0005DZ-9o; Tue, 11 Aug 2015 19:17:18 +0000 Received: from mchehab by smtp.w2.samsung.com with local (Exim 4.85) (envelope-from ) id 1ZPF1Q-0003VM-1L; Tue, 11 Aug 2015 16:15:40 -0300 From: Mauro Carvalho Chehab To: Linux Media Mailing List Subject: [PATCH] c8sectpfe: don't go past channel_data array Date: Tue, 11 Aug 2015 16:15:38 -0300 Message-Id: <298d59cd52c4ecce188439fcd19946ffafe682fc.1439320535.git.mchehab@osg.samsung.com> X-Mailer: git-send-email 2.4.3 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel@stlinux.com, Mauro Carvalho Chehab , Srinivas Kandagatla , Patrice Chotard , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, Maxime Coquelin MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As reported by smatch: drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c:365 find_channel() error: buffer overflow 'fei->channel_data' 8 <= 63 It seems that a cut-and-paste type of error occurred here: the channel_data array size is C8SECTPFE_MAX_TSIN_CHAN, and not C8SECTPFE_MAXCHANNEL. Signed-off-by: Mauro Carvalho Chehab diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c index 3a9109356e67..955d8daf055f 100644 --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c @@ -361,7 +361,7 @@ static struct channel_info *find_channel(struct c8sectpfei *fei, int tsin_num) { int i; - for (i = 0; i < C8SECTPFE_MAXCHANNEL; i++) { + for (i = 0; i < C8SECTPFE_MAX_TSIN_CHAN; i++) { if (!fei->channel_data[i]) continue;