summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--hw/milkymist-softusb.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/milkymist-softusb.c b/hw/milkymist-softusb.c
index b279d4e908..90a0ae5769 100644
--- a/hw/milkymist-softusb.c
+++ b/hw/milkymist-softusb.c
@@ -132,6 +132,7 @@ static inline void softusb_read_dmem(MilkymistSoftUsbState *s,
     if (offset + len >= s->dmem_size) {
         error_report("milkymist_softusb: read dmem out of bounds "
                 "at offset 0x%x, len %d", offset, len);
+        memset(buf, 0, len);
         return;
     }
 
@@ -156,6 +157,7 @@ static inline void softusb_read_pmem(MilkymistSoftUsbState *s,
     if (offset + len >= s->pmem_size) {
         error_report("milkymist_softusb: read pmem out of bounds "
                 "at offset 0x%x, len %d", offset, len);
+        memset(buf, 0, len);
         return;
     }