summary refs log tree commit diff stats
path: root/hw/net/tulip.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2020-04-24 01:16:43 +0200
committerJason Wang <jasowang@redhat.com>2020-06-18 21:05:51 +0800
commit97d7fb5a792b8b289ca6a981d9fe3369fa8b8c3c (patch)
treef365f7d00046d7f5d4ba9c8dd77bddef7f7e4c97 /hw/net/tulip.c
parent171ce2e27906a59e243baf8c67ad1c1193cec4be (diff)
downloadfocaccia-qemu-97d7fb5a792b8b289ca6a981d9fe3369fa8b8c3c.tar.gz
focaccia-qemu-97d7fb5a792b8b289ca6a981d9fe3369fa8b8c3c.zip
hw/net/tulip: Log descriptor overflows
Log with GUEST_ERROR what the guest is doing wrong.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw/net/tulip.c')
-rw-r--r--hw/net/tulip.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/net/tulip.c b/hw/net/tulip.c
index 57ecbe2161..4487fd61cf 100644
--- a/hw/net/tulip.c
+++ b/hw/net/tulip.c
@@ -578,6 +578,9 @@ static int tulip_copy_tx_buffers(TULIPState *s, struct tulip_descriptor *desc)
     int len2 = (desc->control >> TDES1_BUF2_SIZE_SHIFT) & TDES1_BUF2_SIZE_MASK;
 
     if (s->tx_frame_len + len1 > sizeof(s->tx_frame)) {
+        qemu_log_mask(LOG_GUEST_ERROR,
+                      "%s: descriptor overflow (ofs: %u, len:%d, size:%zu)\n",
+                      __func__, s->tx_frame_len, len1, sizeof(s->tx_frame));
         return -1;
     }
     if (len1) {
@@ -587,6 +590,9 @@ static int tulip_copy_tx_buffers(TULIPState *s, struct tulip_descriptor *desc)
     }
 
     if (s->tx_frame_len + len2 > sizeof(s->tx_frame)) {
+        qemu_log_mask(LOG_GUEST_ERROR,
+                      "%s: descriptor overflow (ofs: %u, len:%d, size:%zu)\n",
+                      __func__, s->tx_frame_len, len2, sizeof(s->tx_frame));
         return -1;
     }
     if (len2) {