Message ID | 1511341718-6974-1-git-send-email-m.purski@samsung.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <dri-devel-bounces@lists.freedesktop.org> 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 A833C60375 for <patchwork-dri-devel@patchwork.kernel.org>; Wed, 22 Nov 2017 09:09:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CFB129BA6 for <patchwork-dri-devel@patchwork.kernel.org>; Wed, 22 Nov 2017 09:09:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9173929BFA; Wed, 22 Nov 2017 09:09:09 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D33C829BA6 for <patchwork-dri-devel@patchwork.kernel.org>; Wed, 22 Nov 2017 09:09:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 928A76E5EF; Wed, 22 Nov 2017 09:09:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id B02126E5EF for <dri-devel@lists.freedesktop.org>; Wed, 22 Nov 2017 09:09:03 +0000 (UTC) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20171122090901euoutp01f81ee370256a61b762662dba2482d208~5XU5g5IXD2665126651euoutp01s; Wed, 22 Nov 2017 09:09:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20171122090901euoutp01f81ee370256a61b762662dba2482d208~5XU5g5IXD2665126651euoutp01s DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1511341741; bh=nlETP1poEonj5zvmFn9AzBqK37vM6Vn4fQCD3iUhpbE=; h=From:To:Cc:Subject:Date:References:From; b=m8HrB5r0aaZndomPHdqA+1YJ2Jmt6p8Sce02+4zyVh7YNFgUCh5pyY2lGHwPsVesx 6tqW/cP7YvgKrvh2mYGGhJtkKi72IBxq1OaBMB6mNrmM/I1cl63fVXSu4hB0yRqmjI BAyhInD+k6eAXaWZe+tof0ayCsB132QhHjPF+Yww= Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171122090900eucas1p149947be4c8020e3901f3837c176b6e86~5XU41H6u10331703317eucas1p1x; Wed, 22 Nov 2017 09:09:00 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2.samsung.com (EUCPMTA) with SMTP id A7.FA.12907.CAE351A5; Wed, 22 Nov 2017 09:09:00 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20171122090859eucas1p2b949eeb52273122b9e2747ece69d9ecd~5XU4OMK7m1114211142eucas1p2p; Wed, 22 Nov 2017 09:08:59 +0000 (GMT) X-AuditID: cbfec7f1-f793a6d00000326b-96-5a153eacf624 Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id D6.0E.18832.BAE351A5; Wed, 22 Nov 2017 09:08:59 +0000 (GMT) Received: from AMDC2075.DIGITAL.local ([106.120.51.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OZT00DG4AQT8W70@eusync2.samsung.com>; Wed, 22 Nov 2017 09:08:59 +0000 (GMT) From: Maciej Purski <m.purski@samsung.com> To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/bridge/sii8620: fix potential buffer overflow Date: Wed, 22 Nov 2017 10:08:38 +0100 Message-id: <1511341718-6974-1-git-send-email-m.purski@samsung.com> X-Mailer: git-send-email 2.7.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCIsWRmVeSWpSXmKPExsWy7djPc7pr7ESjDH5v57K4te4cq0XvuZNM Fk0db1ktXv+bzmJx5et7NovOiUvYLRa8vMXiwO5xua+XyWN2x0xWj+3fHrB63O8+zuTx8ekt Fo++LasYA9iiuGxSUnMyy1KL9O0SuDLeXWphKXjOUTHl9COWBsYV7F2MnBwSAiYSOyd2MkPY YhIX7q1n62Lk4hASWMoo8amviwXC+cwoMWnDdsYuRg6wjrO7TEAahASWMUqs+14MUfOfUeLm rGYmkBo2AS2JNe3xIDUiAsoSfyeuYgSpYRb4wygx9eIrsM3CAk4SiydcZAOxWQRUJU7NamEF sXkFnCU2t7xihbhITuLmOZDruIDsRjaJi1OuMUEkXCTerZrEBmELS7w6vgXqHRmJzo6DUDXV Ehe/7oKqqZFovL0BqsZa4vOkLWAvMwvwSUzaNp0Z4jFeiY42IYgSD4mdjdcYIWxHiUuzToH9 LiQQK/Huo+wERqkFjAyrGEVSS4tz01OLjfSKE3OLS/PS9ZLzczcxAuPy9L/jH3cwvj9hdYhR gINRiYd3go1olBBrYllxZe4hRgkOZiUR3r0KQCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8tlFt kUIC6YklqdmpqQWpRTBZJg5OqQbGJAEJQ4Obvccu3Mpq75eL1UuLPK5bdeKN+TeJJ8vOTuIO e83Gf/peWVpt6EStBdejs0MexU4+p6hY/cNivsOrwIs2/nHM8wtWG3VqaM/ySCzvMV8hPePH 8h2OM1mEfytM/ME/ycD4iw2Lwv7DT+9O3LVspl3Oo1x+Tjsny5riZU23FL58vXxZiaU4I9FQ i7moOBEAuxc+1scCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgluLIzCtJLcpLzFFi42I5/e/4Fd3VdqJRBpcf6lncWneO1aL33Ekm i6aOt6wWr/9NZ7G48vU9m0XnxCXsFgte3mJxYPe43NfL5DG7Yyarx/ZvD1g97ncfZ/L4+PQW i0ffllWMAWxRXDYpqTmZZalF+nYJXBnvLrWwFDznqJhy+hFLA+MK9i5GDg4JAROJs7tMuhg5 gUwxiQv31rN1MXJxCAksYZRY8Ps1lNPIJPF1cz8bSAObgJbEmvZ4kAYRAWWJvxNXMYLUMAv8 YZSY8+MeK0hCWMBJYvGEi2wgNouAqsSpWS1gcV4BZ4nNLa9YIbbJSdw818k8gZF7ASPDKkaR 1NLi3PTcYkO94sTc4tK8dL3k/NxNjMBw2Xbs5+YdjJc2Bh9iFOBgVOLhnZEkEiXEmlhWXJl7 iFGCg1lJhHevgmiUEG9KYmVValF+fFFpTmrxIUZpDhYlcd7ePasjhQTSE0tSs1NTC1KLYLJM HJxSDYw5nnX13Fer1ppYWG6TvT/LUmh/Uo6JmkebSt1fPwWT3tglt1ex58e3Cfz7dOtg96Ou TM7uVKXp+s+12R0bXovMS5j8JeiKul6+1Mvtu9Zsn/De7oWeq8r2d3auU4S27v5yl79UsecJ x+N66WfcgtXnF1ZzNvyPe3gt4N0Gnf8slZ5bHn/tm6rEUpyRaKjFXFScCADcDMV9EwIAAA== X-CMS-MailID: 20171122090859eucas1p2b949eeb52273122b9e2747ece69d9ecd X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20171122090859eucas1p2b949eeb52273122b9e2747ece69d9ecd X-RootMTR: 20171122090859eucas1p2b949eeb52273122b9e2747ece69d9ecd References: <CGME20171122090859eucas1p2b949eeb52273122b9e2747ece69d9ecd@eucas1p2.samsung.com> Cc: David Airlie <airlied@linux.ie>, Maciej Purski <m.purski@samsung.com>, Laurent Pinchart <Laurent.pinchart@ideasonboard.com>, Dan Carpenter <dan.carpenter@oracle.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development <dri-devel.lists.freedesktop.org> List-Unsubscribe: <https://lists.freedesktop.org/mailman/options/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=unsubscribe> List-Archive: <https://lists.freedesktop.org/archives/dri-devel> List-Post: <mailto:dri-devel@lists.freedesktop.org> List-Help: <mailto:dri-devel-request@lists.freedesktop.org?subject=help> List-Subscribe: <https://lists.freedesktop.org/mailman/listinfo/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=subscribe> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" <dri-devel-bounces@lists.freedesktop.org> X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/drivers/gpu/drm/bridge/sil-sii8620.c b/drivers/gpu/drm/bridge/sil-sii8620.c index d58db13..25ae0e5 100644 --- a/drivers/gpu/drm/bridge/sil-sii8620.c +++ b/drivers/gpu/drm/bridge/sil-sii8620.c @@ -1210,7 +1210,7 @@ static void sii8620_start_video(struct sii8620 *ctx) int clk = ctx->pixel_clock * (ctx->use_packed_pixel ? 2 : 3); int i; - for (i = 0; i < ARRAY_SIZE(clk_spec); ++i) + for (i = 0; i < ARRAY_SIZE(clk_spec) - 1; ++i) if (clk < clk_spec[i].max_clk) break;
Buffer overflow error should not occur, as mode_fixup() callback filters pixel clock value and it should never exceed 600000. However, current implementation is not obviously safe and relies on implementation of mode_fixup(). Make 'i' variable never reach unsafe value in order to avoid buffer overflow error. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Fixes: bf1722ca ("drm/bridge/sii8620: rewrite hdmi start sequence") Signed-off-by: Maciej Purski <m.purski@samsung.com> --- drivers/gpu/drm/bridge/sil-sii8620.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)