From: Michael Walle <michael@walle.cc>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
qemu-devel@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH] hw/milkymist-softusb: set buffer in softusb_read_{dmem, pmem} error path
Date: Thu, 28 Mar 2013 19:50:15 +0100 [thread overview]
Message-ID: <201303281950.15879.michael@walle.cc> (raw)
In-Reply-To: <1364496184-11994-1-git-send-email-peter.maydell@linaro.org>
Am Donnerstag 28 März 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'.)
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> 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.
>
> hw/milkymist-softusb.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> 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 >=
> 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;
> }
>
> @@ -155,6 +156,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;
> }
Acked-By: Michael Walle <michael@walle.cc>
next prev parent reply other threads:[~2013-03-28 18:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-28 18:43 [Qemu-devel] [PATCH] hw/milkymist-softusb: set buffer in softusb_read_{dmem, pmem} error path Peter Maydell
2013-03-28 18:50 ` Michael Walle [this message]
2013-04-01 20:36 ` Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201303281950.15879.michael@walle.cc \
--to=michael@walle.cc \
--cc=aliguori@us.ibm.com \
--cc=patches@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).