diff options
author | Peter Maydell | 2013-03-28 19:43:04 +0100 |
---|---|---|
committer | Anthony Liguori | 2013-04-01 16:08:33 +0200 |
commit | c31bc98e3bcf52fe1cd4b9b7a70869330eae80ea (patch) | |
tree | 0f10ab513abcc99d67f91fe9912a857bcd67582a | |
parent | milkymist-softusb: Don't map RAM memory regions in the device itself (diff) | |
download | qemu-c31bc98e3bcf52fe1cd4b9b7a70869330eae80ea.tar.gz qemu-c31bc98e3bcf52fe1cd4b9b7a70869330eae80ea.tar.xz qemu-c31bc98e3bcf52fe1cd4b9b7a70869330eae80ea.zip |
hw/milkymist-softusb: set buffer in softusb_read_{dmem, pmem} error path
Make sure we set the buffer to something in the softusb_read_{dmem,pmem}
error paths, since the caller will use the buffer unconditionally.
(Newer gcc is smart enough to spot this and complain about 'may be
used uninitialized'.)
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1364496184-11994-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r-- | hw/milkymist-softusb.c | 2 |
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; } |