From: Eric Auger Date: Fri, 18 May 2018 16:48:07 +0000 (+0100) Subject: hw/arm/smmuv3: Fix Coverity issue in smmuv3_record_event X-Git-Tag: v3.0.0-rc0~144^2~26 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=24af32e049684827286e24114a066e09d0dcdaaf;p=users%2Fdwmw2%2Fqemu.git hw/arm/smmuv3: Fix Coverity issue in smmuv3_record_event Coverity complains about use of uninitialized Evt struct. The EVT_SET_TYPE and similar setters use deposit32() on fields in the struct, so they read the uninitialized existing values. In cases where we don't set all the fields in the event struct we'll end up leaking random uninitialized data from QEMU's stack into the guest. Initializing the struct with "Evt evt = {};" ought to satisfy Coverity and fix the data leak. Signed-off-by: Eric Auger Reported-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-id: 1526493784-25328-2-git-send-email-eric.auger@redhat.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c index b3026dea20..42dc521c13 100644 --- a/hw/arm/smmuv3.c +++ b/hw/arm/smmuv3.c @@ -143,7 +143,7 @@ static MemTxResult smmuv3_write_eventq(SMMUv3State *s, Evt *evt) void smmuv3_record_event(SMMUv3State *s, SMMUEventInfo *info) { - Evt evt; + Evt evt = {}; MemTxResult r; if (!smmuv3_eventq_enabled(s)) {