Message ID | 20210415144414.833339007@linuxfoundation.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a02:6a6f:0:0:0:0:0 with SMTP id m47csp547347jaf; Thu, 15 Apr 2021 07:54:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWGlX4+aGlzzg/7gk9zRhMgiiu+tHGmWA+2i2t5mqJGBl9d+78UZfGH424N3YzTqm3us6q X-Received: by 2002:a17:906:40da:: with SMTP id a26mr3810638ejk.513.1618498446100; Thu, 15 Apr 2021 07:54:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618498446; cv=none; d=google.com; s=arc-20160816; b=M0Rr2TvUUKH8VwrZMTEZD/kYDASDTUrcm9uorQSZZVWBYSWTBjXkFdCpe6i6ssgtin PtTlD8i0ay0FGQ7kz+Mn7y45UtEOdadGgdIM754dV2CGguI7KXXuXWRbE18g6BVkzW/A 5du/iTV6jjxHVARuO47cgqp2Et+Y0S6yzTqDriHLRJdTtfrmhq3EwFSQHu20YszNd4xa hIvx5ucaMH7d8kTVhZr/ORXKncfH43Udh8BtlKsMtm6fxBf9IfUyZtkF31NorXa1/qLd 82Zfpsu5lxa9H49q5Ko6X5B4Zi1E3VlTcgif9RFRPOlxxcDkk9fU8nRb+Gc84CtOc4l9 S+1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eyaxKh5VSqFAzDreyR5TCIo1/uVTIaZLu3i9ntaShC4=; b=ZQk3XByqHYo0vThkhwRy0lC0DqyjvuBTdS7hiLJKFK1XQwcZjwSZA8ms/dVlICo72V AoeBm5nZPqGPLHScScUQCP42H2fZ/yR/K8/AKP1c1EXwbF3EPzP/u5PxJmMGIr6Pfbj1 LPMSLQtIrvicXcACRnT/Xr5rOvLswjUbWkBOiY2Rq0ucOwJApB69JI1ydhc8HJ++qugj oJsTsCa4OpcyJjzP8qpu9U8U4Hi8lwbBPwCG1xjvTM2bbqgpJyQolmnkb7/iEvIFsHB+ YA2pVW8nj/eu/YUY/rDNWu9K234LfQxS2enfNiMEbV3XvMot3XaDImCMlDUWkqpuAvtw 8WMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YUwNry29; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: <stable-owner@vger.kernel.org> Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b12si2349646edd.19.2021.04.15.07.54.05; Thu, 15 Apr 2021 07:54:06 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YUwNry29; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234116AbhDOOyV (ORCPT <rfc822;semen.protsenko@linaro.org> + 12 others); Thu, 15 Apr 2021 10:54:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:40358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233889AbhDOOwX (ORCPT <rfc822;stable@vger.kernel.org>); Thu, 15 Apr 2021 10:52:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4E8D8613C1; Thu, 15 Apr 2021 14:51:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618498319; bh=NP6z82y8UYkzlwGvlhVl2v3BmtjsrN94IHTrZKg4lEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YUwNry29cRl6/JDtL7z2LQ6qWd6ZIVkhN7yThXI+/UYRZbpBwgYPpivcVoIpEnVR0 9VRxFh2v4VUrZYG7rcEMwL8vObFrU6u0nDFok/rH2YX3lqPJQ+dZWmYtCVVIrTOId2 Mit2W+FC6GcRjZJ2NCdzyqwktQIKZEgV5/tVc2QE= From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, stable@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>, Liu Ying <victor.liu@nxp.com>, Philipp Zabel <p.zabel@pengutronix.de>, Sasha Levin <sashal@kernel.org> Subject: [PATCH 4.9 43/47] drm/imx: imx-ldb: fix out of bounds array access warning Date: Thu, 15 Apr 2021 16:47:35 +0200 Message-Id: <20210415144414.833339007@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210415144413.487943796@linuxfoundation.org> References: <20210415144413.487943796@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <stable.vger.kernel.org> X-Mailing-List: stable@vger.kernel.org |
Series |
None
|
expand
|
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c index 2df407b2b0da..3a9d06de81b4 100644 --- a/drivers/gpu/drm/imx/imx-ldb.c +++ b/drivers/gpu/drm/imx/imx-ldb.c @@ -212,6 +212,11 @@ static void imx_ldb_encoder_enable(struct drm_encoder *encoder) int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; int mux = drm_of_encoder_active_port_id(imx_ldb_ch->child, encoder); + if (mux < 0 || mux >= ARRAY_SIZE(ldb->clk_sel)) { + dev_warn(ldb->dev, "%s: invalid mux %d\n", __func__, mux); + return; + } + drm_panel_prepare(imx_ldb_ch->panel); if (dual) { @@ -270,6 +275,11 @@ imx_ldb_encoder_atomic_mode_set(struct drm_encoder *encoder, int mux = drm_of_encoder_active_port_id(imx_ldb_ch->child, encoder); u32 bus_format = imx_ldb_ch->bus_format; + if (mux < 0 || mux >= ARRAY_SIZE(ldb->clk_sel)) { + dev_warn(ldb->dev, "%s: invalid mux %d\n", __func__, mux); + return; + } + if (mode->clock > 170000) { dev_warn(ldb->dev, "%s: mode exceeds 170 MHz pixel clock\n", __func__);