Message ID | 20210415144414.492206846@linuxfoundation.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a02:6a6f:0:0:0:0:0 with SMTP id m47csp545027jaf; Thu, 15 Apr 2021 07:51:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwE5MM1O0N/pWAE+zAJX13wmcmzMcITDdIpP1WtjPdQDqtLvf9ra6XQ0jEbctdS5H49B1SR X-Received: by 2002:a05:6a00:238d:b029:249:cc83:c23a with SMTP id f13-20020a056a00238db0290249cc83c23amr3508670pfc.19.1618498262802; Thu, 15 Apr 2021 07:51:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618498262; cv=none; d=google.com; s=arc-20160816; b=EcjTs64ldqosQAkVOZVENzOpAIafdfX6yXJjE6XDXiJ1p0lj2S1uwgPg0uaURlyMyd 9Ha516sHu7PzBjkV4b7rCqC8KdIMDwqbyI7mcl0PlK6Qqkv7M6vi8pJGOJmkS9sBYYXr wgwHw0sQQ4DutFb+MviM+7AfEzDadjwzuGYDyTFp50H0pFexJ0rnC2KkN47UkMYQEOCI ikO7ACkDO6p9JwP1gmRuLmMWdBUSwZd3Wcy6V4TRDadPziFBxAV3pNp1gcxcvCWQTfCI 2PYTtMVS1A0neIGiiLIXK50qjmiViujYhF5e/oolUSR+R8tuHomLvc4qoGIRayVvMSNn 6Gjw== 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=A70U8QIFYYLmDN37tdz3/NgNZu2my+OWrGeZPo2S+GM=; b=yJjungZQDaZANdBuJVxdsAJtEp5Hq3gqDXeU8TLN/mXDmfAKtuAhZAQM0rSElIJ2XP D8+1tohEmUBLzcYc8q78+xdn2PRlHOJLg5J+facZLttn2IERz8DY2Os+twH9hlXqLKn6 uvj65nq0ZwBvk6q/ow2mfdf/+3jyoLBznrci6dNl33gPvWGeCsK4ZHla+m/uXT80t705 NjFQo0YuLXnybW6T9hS+RiwoHGZaLIfuXXo6CYvCn6R0l8+icqGD6F06phucQU+DRLxM m7LUFayLFk+jRmBVsfWuLfEIaMR1g2A4P2e4ehOMv4V2XO8t6B449OPVsj5hy7TX4T57 Saew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gwgOHYX5; 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 q16si3433886pgg.312.2021.04.15.07.51.02; Thu, 15 Apr 2021 07:51:02 -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=gwgOHYX5; 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 S234097AbhDOOvV (ORCPT <rfc822;semen.protsenko@linaro.org> + 12 others); Thu, 15 Apr 2021 10:51:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:37724 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233973AbhDOOul (ORCPT <rfc822;stable@vger.kernel.org>); Thu, 15 Apr 2021 10:50:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3CB926137D; Thu, 15 Apr 2021 14:50:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618498218; bh=Nw8MRyPv6hItzUsKE/Wox9Bq6mnbMARlYufUwDjARLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gwgOHYX5Wq5ai41JXmS149gXQdIogHAyTi1wrmo9vWc4E1UUQfl4ziZsxipVGD3LM jWU4BxxL/pFQCBl+wts/4IgDG/2poqiJTEQzbKIps58JQee92uS8IkDRV7Kh9qS33i /M52WZ8nQMNJ54tVcoOa0g+abZOhg8lXBj77xuwA= 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.4 35/38] drm/imx: imx-ldb: fix out of bounds array access warning Date: Thu, 15 Apr 2021 16:47:29 +0200 Message-Id: <20210415144414.492206846@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210415144413.352638802@linuxfoundation.org> References: <20210415144413.352638802@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 b9dc2ef64ed8..74585ba16501 100644 --- a/drivers/gpu/drm/imx/imx-ldb.c +++ b/drivers/gpu/drm/imx/imx-ldb.c @@ -217,6 +217,11 @@ static void imx_ldb_encoder_commit(struct drm_encoder *encoder) int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN; int mux = imx_drm_encoder_get_mux_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) { @@ -267,6 +272,11 @@ static void imx_ldb_encoder_mode_set(struct drm_encoder *encoder, unsigned long di_clk = mode->clock * 1000; int mux = imx_drm_encoder_get_mux_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; + } + if (mode->clock > 170000) { dev_warn(ldb->dev, "%s: mode exceeds 170 MHz pixel clock\n", __func__);