From patchwork Sun Oct 13 10:16:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roel Kluin X-Patchwork-Id: 3033061 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5CC79BF924 for ; Sun, 13 Oct 2013 10:16:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 860EC20334 for ; Sun, 13 Oct 2013 10:16:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AAA4D2021F for ; Sun, 13 Oct 2013 10:16:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754289Ab3JMKQg (ORCPT ); Sun, 13 Oct 2013 06:16:36 -0400 Received: from mail-ea0-f182.google.com ([209.85.215.182]:40054 "EHLO mail-ea0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754273Ab3JMKQf (ORCPT ); Sun, 13 Oct 2013 06:16:35 -0400 Received: by mail-ea0-f182.google.com with SMTP id o10so2752544eaj.41 for ; Sun, 13 Oct 2013 03:16:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:user-agent:mime-version :content-type; bh=45Fl6mp/gm6ykwiT6Oi8Iw3d6O0Z0FYLa8QVzuKqmAw=; b=VtAMO+M+AhExKZ42qSTalYSvTSHC61dd1HaI4fHSfpXYHBarbwiB0xLTyxgZtR/m0Z W3Y98abff33RGBwA99QbIvn0fFM3Sjqk1Wsjpiwhw0AvTbWfXKVEBWR08cDqNWaAG+qs NrKzDUXBFB4FB3TfTqC0ejvybH7MSToTrqmKAsTk6BHPV3CJg6T3ZbmkzHp+mF3TtU0S 1IgRWjD3rhZEcq9DUfVT87zakIpWRZ4QTFT9k6TwPunCISZujudCz6Ytm4/1nLoOj38q V+eZrBB2X0SSSzykXD7Na5EBNYF1fvcqtvyMk6PyLMb9eDdJGFs16o9XL+sBnmIK1j5d XsWA== X-Received: by 10.14.212.72 with SMTP id x48mr40780449eeo.0.1381659394381; Sun, 13 Oct 2013 03:16:34 -0700 (PDT) Received: from Z (d594e6f2.dsl.concepts.nl. [213.148.230.242]) by mx.google.com with ESMTPSA id b45sm138653133eef.4.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 13 Oct 2013 03:16:33 -0700 (PDT) Date: Sun, 13 Oct 2013 12:16:30 +0200 (CEST) From: Roel Kluin To: Kyungmin Park , Sylwester Nawrocki , Mauro Carvalho Chehab , Kukjin Kim , linux-media@vger.kernel.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org Subject: exynos4: index out of bounds if no pixelcode found Message-ID: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 In case no valid pixelcode is found, an i of -1 after the loop is out of bounds for the array. Signed-off-by: Roel Kluin --- } @@ -240,7 +240,7 @@ static void flite_hw_set_out_order(struct fimc_lite *dev, struct flite_frame *f) u32 cfg = readl(dev->regs + FLITE_REG_CIODMAFMT); int i = ARRAY_SIZE(pixcode); - while (--i >= 0) + while (--i) if (pixcode[i][0] == f->fmt->mbus_code) break; cfg &= ~FLITE_REG_CIODMAFMT_YCBCR_ORDER_MASK; -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/platform/exynos4-is/fimc-lite-reg.c b/drivers/media/platform/exynos4-is/fimc-lite-reg.c index 72a343e3b..d0dc7ee 100644 --- a/drivers/media/platform/exynos4-is/fimc-lite-reg.c +++ b/drivers/media/platform/exynos4-is/fimc-lite-reg.c @@ -133,7 +133,7 @@ void flite_hw_set_source_format(struct fimc_lite *dev, struct flite_frame *f) int i = ARRAY_SIZE(src_pixfmt_map); u32 cfg; - while (--i >= 0) { + while (--i) { if (src_pixfmt_map[i][0] == pixelcode) break;