Skip to contentSkip to conversation

drm/bridge: anx7625: Fix overflow issue on reading EDID

PATCH Applied Pin-Yen Lin 2 participants 2 messages Feb 10, 2022 – Feb 14, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/bridge: anx7625: Fix overflow issue on reading EDID

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")

---

Changes in v2:
- add "Fixes" tag
- collect review tag

 drivers/gpu/drm/bridge/analogix/anx7625.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +2 -1
index 2346dbcc505f..e596cacce9e3 100644
@@ -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;
Signature · 1 line
2.35.0.263.gb82422642f-goog
Applied
#1 lore raw
Quoted 31 lines · Pin-Yen Lin

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")

---

Changes in v2:
- add "Fixes" tag
- collect review tag

 drivers/gpu/drm/bridge/analogix/anx7625.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +2 -2
index 2346dbcc505f..e596cacce9e3 100644
@@ -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;
--
Quoted 2 lines

2.35.0.263.gb82422642f-goog

Applied to drm-misc-next.