Message ID | 20210415144416.513536380@linuxfoundation.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a02:6a6f:0:0:0:0:0 with SMTP id m47csp553221jaf; Thu, 15 Apr 2021 08:01:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYX7/0ge3O+DCemGBndG7y4edAEvmrFJKgyaKOvkBQKY6pz0C3Rl1Yw3gIm9McnXavkDh3 X-Received: by 2002:a17:906:5597:: with SMTP id y23mr3958016ejp.165.1618498879947; Thu, 15 Apr 2021 08:01:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618498879; cv=none; d=google.com; s=arc-20160816; b=q+SV+S2ZCsy9rg25zWknjlcPke659cZa3IpfeObuYnHnHxHUTJG8EhgVndyTyqZgDV LeqCPHQHfw8XvNqrrPT6tz6D4QkJmOlt04XaPIWa9fDbiQ1hYKc6Pr0F6fVu29SPB5xh GZFg1LZ9W4h3CcCHrGefu+mvuf5ML2hHOIlHQveBYDd+GTdtst0k3GJ5EY2TPiBJr8OI qndfAFy+agWdWHimeHbTUgR7taev8pmGLEJE8C2MywucT3EEgkUcuDA9lBHGZu4uaqnh GIdqV2927aCIzSLt0S8JVwpzGxrIHwd8yKzzY/UiclV38U2taTG1k1rnsO7IzbGFPvrx w/tA== 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=dc5vAR+JjZaGqdvUxqbghBrY6js8GMlKZCl8AmABumY=; b=gJ2jJEJGV+vGPsXmMf1ra18P2TKRiD8IDJOmAb95x+eaQAPoEaecmDPBUXglF+xh/T LA4quD4naknmpMTPBFvCfqKlAP+l02oXIsPjO0SHD6m1aXFMNbzKdpopMjTYPULrq7i3 lqpt3q2opdF4SxQin8szIBZzdVKNapbAt62+eCFfP/Ndg4SQKh1l6xkQ/A9Kh0fkZ4Hg O/8AaR5vr9rIw+BoBOU5SN8s10WLTAJIvoSBJOEo5XPznHW1Q4iFkWl+UUtrf1oRAi8E dmt5Zy52e9Y2bpZqGXP0KFck5PmXhSHaAs4ViwQXyPN9s1P0GdKfNUZHoBgktfGHPTAM zIzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UH3xVHWs; 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 k7si2442560eji.230.2021.04.15.08.01.19; Thu, 15 Apr 2021 08:01:19 -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=UH3xVHWs; 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 S233763AbhDOPBi (ORCPT <rfc822;semen.protsenko@linaro.org> + 12 others); Thu, 15 Apr 2021 11:01:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:46934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234068AbhDOO6v (ORCPT <rfc822;stable@vger.kernel.org>); Thu, 15 Apr 2021 10:58:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D3A18613DC; Thu, 15 Apr 2021 14:55:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618498505; bh=ryiPGxLXDF1h365Dz+7XDWnLjwXbgkY02hs5TSBDcUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UH3xVHWs1KMUMZfuO/XDiwW1BJ9ELhb16qZJCeKV7d+DjR8+wEMB+jFMWIv7AIkOh W4Df3O4rgh4651VR0vpQxXEtLX7taW9PL2wHRLviJDWobYOVEL6gYlVvoUht4DXx6f 95SPlU+xYlqvHOJIyxy9E7CTWlPGzJsfc1pb/+RI= 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.14 62/68] drm/imx: imx-ldb: fix out of bounds array access warning Date: Thu, 15 Apr 2021 16:47:43 +0200 Message-Id: <20210415144416.513536380@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210415144414.464797272@linuxfoundation.org> References: <20210415144414.464797272@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 d38648a7ef2d..d88ac6f2222a 100644 --- a/drivers/gpu/drm/imx/imx-ldb.c +++ b/drivers/gpu/drm/imx/imx-ldb.c @@ -206,6 +206,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) { @@ -264,6 +269,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__);