Skip to contentSkip to conversation

hw/display/xlnx_dp: fix overflow in xlnx_dp_aux_push_tx_fifo()

PATCH In review Qiang Liu 4 participants 5 messages Jan 9, 2023 – Jan 11, 2023

lore
Share & tools
lore

Qiang Liu

author
#0 lore raw

PATCH 1/1 hw/display/xlnx_dp: fix overflow in xlnx_dp_aux_push_tx_fifo()

This patch checks if the s->tx_fifo is full.

Fixes 58ac482a66de ("introduce xlnx-dp")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1424

---
 hw/display/xlnx_dp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
hw/display/xlnx_dp.c +5 -1
index 972473d94f..617b394af2 100644
@@ -854,7 +854,11 @@ static void xlnx_dp_write(void *opaque, hwaddr offset, uint64_t value,
         break;
     case DP_AUX_WRITE_FIFO: {
         uint8_t c = value;
-        xlnx_dp_aux_push_tx_fifo(s, &c, 1);
+        if (fifo8_is_full(&s->tx_fifo)) {
+            qemu_log_mask(LOG_GUEST_ERROR, "xlnx_dp: TX fifo is full");
+        } else {
+            xlnx_dp_aux_push_tx_fifo(s, &c, 1);
+        }
         break;
     }
     case DP_AUX_CLOCK_DIVIDER:
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Qiang Liu

This patch checks if the s->tx_fifo is full.

Fixes 58ac482a66de ("introduce xlnx-dp")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1424

Alistair

Quoted 25 lines
---
 hw/display/xlnx_dp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
hw/display/xlnx_dp.c +5 -2
index 972473d94f..617b394af2 100644
@@ -854,7 +854,11 @@ static void xlnx_dp_write(void *opaque, hwaddr offset, uint64_t value,
         break;
     case DP_AUX_WRITE_FIFO: {
         uint8_t c = value;
-        xlnx_dp_aux_push_tx_fifo(s, &c, 1);
+        if (fifo8_is_full(&s->tx_fifo)) {
+            qemu_log_mask(LOG_GUEST_ERROR, "xlnx_dp: TX fifo is full");
+        } else {
+            xlnx_dp_aux_push_tx_fifo(s, &c, 1);
+        }
         break;
     }
     case DP_AUX_CLOCK_DIVIDER:
--

2.25.1

Reviewed-by on v1 1/1
#2 lore raw
In reply to Qiang Liu
Quoted 1 line · Qiang Liu

This patch checks if the s->tx_fifo is full.

+ CC: Fred

Quoted 30 lines
Fixes 58ac482a66de ("introduce xlnx-dp")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1424

---
 hw/display/xlnx_dp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
hw/display/xlnx_dp.c +5 -1
index 972473d94f..617b394af2 100644
@@ -854,7 +854,11 @@ static void xlnx_dp_write(void *opaque, hwaddr offset, uint64_t value,
         break;
     case DP_AUX_WRITE_FIFO: {
         uint8_t c = value;
-        xlnx_dp_aux_push_tx_fifo(s, &c, 1);
+        if (fifo8_is_full(&s->tx_fifo)) {
+            qemu_log_mask(LOG_GUEST_ERROR, "xlnx_dp: TX fifo is full");
+        } else {
+            xlnx_dp_aux_push_tx_fifo(s, &c, 1);
+        }
         break;
     }
     case DP_AUX_CLOCK_DIVIDER:
Signature · 1 line
2.25.1
#3 lore raw
In reply to Qiang Liu

Hi,

Quoted 24 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Qiang Liu
Sent: 09 January 2023 07:00
To: [email protected]
Cc: Qiang Liu <[email protected]>; Alistair Francis <[email protected]>; Edgar E. Iglesias <[email protected]>; Peter Maydell <[email protected]>; open list:Xilinx ZynqMP and... <[email protected]>
Subject: [PATCH] hw/display/xlnx_dp: fix overflow in xlnx_dp_aux_push_tx_fifo()

This patch checks if the s->tx_fifo is full.

Fixes 58ac482a66de ("introduce xlnx-dp")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1424

---
 hw/display/xlnx_dp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
hw/display/xlnx_dp.c +0 -0
index 972473d94f..617b394af2 100644

hw/display/xlnx_dp.c static void xlnx_dp_write(void *opaque, hwaddr offset, uint64_t value, · line 861

Quoted 9 lines
hw/display/xlnx_dp.c +5 -1
@@ -854,7 +854,11 @@ static void xlnx_dp_write(void *opaque, hwaddr offset, uint64_t value,
         break;
     case DP_AUX_WRITE_FIFO: {
         uint8_t c = value;
-        xlnx_dp_aux_push_tx_fifo(s, &c, 1);
+        if (fifo8_is_full(&s->tx_fifo)) {
+            qemu_log_mask(LOG_GUEST_ERROR, "xlnx_dp: TX fifo is full");
+        } else {
+            xlnx_dp_aux_push_tx_fifo(s, &c, 1);
+        }

I'd rather move the check in xlnx_dp_aux_push_tx_fifo, like xlnx_dp_aux_pop_tx_fifo. Otherwise looks good to me.

Thanks,
Fred

Quoted 6 lines
hw/display/xlnx_dp.c +0 -1
         break;
     }
     case DP_AUX_CLOCK_DIVIDER:
--

2.25.1

author
#4 lore raw

Dear Fred,

Quoted 42 lines · Frederic

Hi,

Quoted 2 lines

-----Original Message-----
From: [email protected]

<[email protected]> On Behalf Of

Quoted 4 lines

Qiang Liu
Sent: 09 January 2023 07:00
To: [email protected]
Cc: Qiang Liu <[email protected]>; Alistair Francis <

[email protected]>; Edgar E. Iglesias <[email protected]>; Peter

Quoted 1 line

Maydell <[email protected]>; open list:Xilinx ZynqMP and... <

[email protected]>

Quoted 1 line

Subject: [PATCH] hw/display/xlnx_dp: fix overflow in

xlnx_dp_aux_push_tx_fifo()

hw/display/xlnx_dp.c static void xlnx_dp_write(void *opaque, hwaddr

Quoted 16 lines

This patch checks if the s->tx_fifo is full.

Fixes 58ac482a66de ("introduce xlnx-dp")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1424

---
 hw/display/xlnx_dp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
hw/display/xlnx_dp.c +0 -0
index 972473d94f..617b394af2 100644
@@ -854,7 +854,11 @@ static void xlnx_dp_write(void *opaque, hwaddr

offset, uint64_t value,

hw/display/xlnx_dp.c static void xlnx_dp_write(void *opaque, hwaddr offset, uint64_t value, · line 861

Quoted 9 lines
hw/display/xlnx_dp.c +5 -1
         break;
     case DP_AUX_WRITE_FIFO: {
         uint8_t c = value;
-        xlnx_dp_aux_push_tx_fifo(s, &c, 1);
+        if (fifo8_is_full(&s->tx_fifo)) {
+            qemu_log_mask(LOG_GUEST_ERROR, "xlnx_dp: TX fifo is full");
+        } else {
+            xlnx_dp_aux_push_tx_fifo(s, &c, 1);
+        }
Quoted 4 lines

I'd rather move the check in xlnx_dp_aux_push_tx_fifo, like xlnx_dp_aux_pop_tx_fifo.
Otherwise looks good to me.

Sounds fine. Let me resend a patch.

Best,
Qiang