From patchwork Tue Apr 5 07:25:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 556990 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11458C433F5 for ; Tue, 5 Apr 2022 11:23:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359728AbiDELUh (ORCPT ); Tue, 5 Apr 2022 07:20:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349083AbiDEJtF (ORCPT ); Tue, 5 Apr 2022 05:49:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6EE0A9954; Tue, 5 Apr 2022 02:40:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6131461368; Tue, 5 Apr 2022 09:40:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 739ADC385A1; Tue, 5 Apr 2022 09:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151620; bh=FRqpS+ncOPgVVYOIeYZRCM3+5pFDlgJHad2SKWV8qzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YlQwB8hepa67lIyl9waxsGNAEUK5mVFIxBDaz6QMRu1+Iusp9wHjpJZ+Y32q8CJRD nz9FtGLpMp9j3N5luAH3Z5zUVZEMwoszKmg9R6U2xTIiCnQVyxDeipwekQf38xdL4W pgkgb6+kdgsdt52jUI6cv4XkJPEwHyMkLSuAl0wU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pin-Yen Lin , Jernej Skrabec , Robert Foss , Sasha Levin Subject: [PATCH 5.15 454/913] drm/bridge: anx7625: Fix overflow issue on reading EDID Date: Tue, 5 Apr 2022 09:25:16 +0200 Message-Id: <20220405070353.457356586@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Pin-Yen Lin [ Upstream commit d5c6f647aec9ed524aedd04a3aec5ebc21d39007 ] The length of EDID block can be longer than 256 bytes, so we should use `int` instead of `u8` for the `edid_pos` variable. Fixes: 8bdfc5dae4e3 ("drm/bridge: anx7625: Add anx7625 MIPI DSI/DPI to DP") Signed-off-by: Pin-Yen Lin Reviewed-by: Jernej Skrabec Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220210103827.402436-1-treapking@chromium.org Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/analogix/anx7625.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index ea414cd349b5..392a9c56e9a0 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -791,7 +791,8 @@ static int segments_edid_read(struct anx7625_data *ctx, static int sp_tx_edid_read(struct anx7625_data *ctx, u8 *pedid_blocks_buf) { - u8 offset, edid_pos; + u8 offset; + int edid_pos; int count, blocks_num; u8 pblock_buf[MAX_DPCD_BUFFER_SIZE]; u8 i, j;