From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45284) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULHuQ-0004Aj-Lu for qemu-devel@nongnu.org; Thu, 28 Mar 2013 14:50:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULHuM-0002Z3-Sx for qemu-devel@nongnu.org; Thu, 28 Mar 2013 14:50:46 -0400 Received: from ssl.serverraum.org ([88.198.40.39]:58813) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULHuM-0002Yi-Dv for qemu-devel@nongnu.org; Thu, 28 Mar 2013 14:50:42 -0400 From: Michael Walle Date: Thu, 28 Mar 2013 19:50:15 +0100 References: <1364496184-11994-1-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1364496184-11994-1-git-send-email-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Message-Id: <201303281950.15879.michael@walle.cc> Subject: Re: [Qemu-devel] [PATCH] hw/milkymist-softusb: set buffer in softusb_read_{dmem, pmem} error path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Anthony Liguori , qemu-devel@nongnu.org, patches@linaro.org Am Donnerstag 28 M=E4rz 2013, 19:43:04 schrieb Peter Maydell: > 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'.) >=20 > Signed-off-by: Peter Maydell > --- > This needs to be applied before the 'drop sysbus_add_mem' patchset to > fix a compilation failure with newer gcc. That patchset should apply > after this without needing rebase, I think. >=20 > hw/milkymist-softusb.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > diff --git a/hw/milkymist-softusb.c b/hw/milkymist-softusb.c > index d911686..9f83209 100644 > --- a/hw/milkymist-softusb.c > +++ b/hw/milkymist-softusb.c > @@ -131,6 +131,7 @@ static inline void > softusb_read_dmem(MilkymistSoftUsbState *s, if (offset + len >=3D > 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; > } >=20 > @@ -155,6 +156,7 @@ static inline void > softusb_read_pmem(MilkymistSoftUsbState *s, if (offset + len >=3D > 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; > } Acked-By: Michael Walle