drm/bridge: anx7625: Fix overflow issue on reading EDID
authorPin-Yen Lin <treapking@chromium.org>
Thu, 10 Feb 2022 10:38:27 +0000 (18:38 +0800)
committerRobert Foss <robert.foss@linaro.org>
Mon, 14 Feb 2022 15:21:59 +0000 (16:21 +0100)
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 <treapking@chromium.org>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220210103827.402436-1-treapking@chromium.org
drivers/gpu/drm/bridge/analogix/anx7625.c

index a59a4f4d2c5b1009cdafad2770751bdd1f6edb84..633618bafd75d3087cb4797b28c63b8d2f05f241 100644 (file)
@@ -1109,7 +1109,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;