From patchwork Thu Feb 10 10:38:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pin-yen Lin X-Patchwork-Id: 12742988 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E95E0C433EF for ; Fri, 11 Feb 2022 07:48:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B5CF10E9F1; Fri, 11 Feb 2022 07:47:52 +0000 (UTC) Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by gabe.freedesktop.org (Postfix) with ESMTPS id AB71810E7DC for ; Thu, 10 Feb 2022 10:38:52 +0000 (UTC) Received: by mail-pj1-x1042.google.com with SMTP id v5-20020a17090a4ec500b001b8b702df57so8075585pjl.2 for ; Thu, 10 Feb 2022 02:38:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=81HmC6N36AUv3DS+gd84GgUi8DyL6BEk+8tTF7TOR9A=; b=klBWVq+VcpD1JwYhqrguON/wgfmRIoeAkScl31urYeBrPusoY43z4JDi85XGNQ/nAi HNpnPOrNRyM/rETRpPRxnLjtBJaagIoMTide+qa+TG0/D6Z3ZuGMpG7qqNbcmsdxzBPr Cs6gy3oP686jfbbE1xNzeAz2dv27FFO/FDo2Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=81HmC6N36AUv3DS+gd84GgUi8DyL6BEk+8tTF7TOR9A=; b=NdSSXF+EOySkP1hHhVyq1aS8/nXji1cEH5CRpucIuzfpxZVVVnvWITouay2wqgoiY1 ut10VhXkPoHMNi22IdjwS6i28Fyd6gI9b1EsKu/TKjrabup8JNCw6shSZcw/Fyl283Om fR7/af/ZujI34GctGzIPkfuoayfJLHsDWsxjHDOpl2Esac429lPr2UCHg27ue2nEWTEI Thpc/7szvPmz1bmIEQvXm3lqs/AIfGAXinWVOvuDi3WKr5mjan4XqtM05fBLSIMKSSLW 1R9V45LBWFVjntgzhe5ddItAXxzIE09Wqcg6Z16ejVskZLT+DYuLJmLJBvkvwmSYgufk v2OQ== X-Gm-Message-State: AOAM531DXyHBTj/JS2TyKrJed8y1tMqvDCdD1nX4xh1T+U4W7gV1qrCx /eI21sZFotagumO60dS71FM8sw== X-Google-Smtp-Source: ABdhPJw6jVYVhpS6k6vjV9oF1u9DeF+GSlGVoL2BQ6ahDbbjqdm4ZYNVRMvJVMCT6iAALcoRHBUljQ== X-Received: by 2002:a17:902:8f92:: with SMTP id z18mr7040383plo.42.1644489532286; Thu, 10 Feb 2022 02:38:52 -0800 (PST) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:b164:4f36:23f1:78c]) by smtp.gmail.com with ESMTPSA id c4sm10941176pfl.131.2022.02.10.02.38.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 02:38:51 -0800 (PST) From: Pin-Yen Lin To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter Subject: [PATCH v2] drm/bridge: anx7625: Fix overflow issue on reading EDID Date: Thu, 10 Feb 2022 18:38:27 +0800 Message-Id: <20220210103827.402436-1-treapking@chromium.org> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 11 Feb 2022 07:47:51 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tzung-Bi Shih , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Pin-Yen Lin , Maxime Ripard , Pi-Hsun Shih , Hsin-Yi Wang , Sam Ravnborg , Xin Ji Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- Changes in v2: - add "Fixes" tag - collect review tag 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 2346dbcc505f..e596cacce9e3 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -846,7 +846,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;