hw/display/xlnx_dp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
This patch checks if the s->tx_fifo is full.
Fixes: 58ac482a66de ("introduce xlnx-dp")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1424
Reported-by: Qiang Liu <cyruscyliu@gmail.com>
Signed-off-by: Qiang Liu <cyruscyliu@gmail.com>
---
hw/display/xlnx_dp.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c
index 972473d94f..617b394af2 100644
--- a/hw/display/xlnx_dp.c
+++ b/hw/display/xlnx_dp.c
@@ -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
Hi,
> -----Original Message-----
> From: qemu-devel-bounces+fkonrad=amd.com@nongnu.org <qemu-devel-bounces+fkonrad=amd.com@nongnu.org> On Behalf Of
> Qiang Liu
> Sent: 09 January 2023 07:00
> To: qemu-devel@nongnu.org
> Cc: Qiang Liu <cyruscyliu@gmail.com>; Alistair Francis <alistair@alistair23.me>; Edgar E. Iglesias <edgar.iglesias@gmail.com>; Peter
> Maydell <peter.maydell@linaro.org>; open list:Xilinx ZynqMP and... <qemu-arm@nongnu.org>
> 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
> Reported-by: Qiang Liu <cyruscyliu@gmail.com>
> Signed-off-by: Qiang Liu <cyruscyliu@gmail.com>
> ---
> hw/display/xlnx_dp.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c
> index 972473d94f..617b394af2 100644
> --- a/hw/display/xlnx_dp.c
> +++ b/hw/display/xlnx_dp.c
> @@ -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
> break;
> }
> case DP_AUX_CLOCK_DIVIDER:
> --
> 2.25.1
>
Dear Fred,
On Tue, Jan 10, 2023 at 9:57 PM Konrad, Frederic <Frederic.Konrad@amd.com>
wrote:
> Hi,
>
> > -----Original Message-----
> > From: qemu-devel-bounces+fkonrad=amd.com@nongnu.org
> <qemu-devel-bounces+fkonrad=amd.com@nongnu.org> On Behalf Of
> > Qiang Liu
> > Sent: 09 January 2023 07:00
> > To: qemu-devel@nongnu.org
> > Cc: Qiang Liu <cyruscyliu@gmail.com>; Alistair Francis <
> alistair@alistair23.me>; Edgar E. Iglesias <edgar.iglesias@gmail.com>;
> Peter
> > Maydell <peter.maydell@linaro.org>; open list:Xilinx ZynqMP and... <
> qemu-arm@nongnu.org>
> > 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
> > Reported-by: Qiang Liu <cyruscyliu@gmail.com>
> > Signed-off-by: Qiang Liu <cyruscyliu@gmail.com>
> > ---
> > hw/display/xlnx_dp.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c
> > index 972473d94f..617b394af2 100644
> > --- a/hw/display/xlnx_dp.c
> > +++ b/hw/display/xlnx_dp.c
> > @@ -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.
>
Sounds fine. Let me resend a patch.
Best,
Qiang
On Mon, Jan 09, 2023 at 01:59:33PM +0800, Qiang Liu wrote:
> This patch checks if the s->tx_fifo is full.
+ CC: Fred
Reviewed-by: Edgar E. Iglesias <edgar@zeroasic.com>
>
> Fixes: 58ac482a66de ("introduce xlnx-dp")
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1424
> Reported-by: Qiang Liu <cyruscyliu@gmail.com>
> Signed-off-by: Qiang Liu <cyruscyliu@gmail.com>
> ---
> hw/display/xlnx_dp.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c
> index 972473d94f..617b394af2 100644
> --- a/hw/display/xlnx_dp.c
> +++ b/hw/display/xlnx_dp.c
> @@ -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
>
>
On Mon, Jan 9, 2023 at 4:01 PM Qiang Liu <cyruscyliu@gmail.com> wrote:
>
> This patch checks if the s->tx_fifo is full.
>
> Fixes: 58ac482a66de ("introduce xlnx-dp")
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1424
> Reported-by: Qiang Liu <cyruscyliu@gmail.com>
> Signed-off-by: Qiang Liu <cyruscyliu@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> hw/display/xlnx_dp.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c
> index 972473d94f..617b394af2 100644
> --- a/hw/display/xlnx_dp.c
> +++ b/hw/display/xlnx_dp.c
> @@ -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
>
>
© 2016 - 2026 Red Hat, Inc.