From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, kraxel@redhat.com, peterx@redhat.com,
peter.maydell@linaro.org
Subject: [Qemu-devel] [PATCH] usb: fix unbound stack warning for inotify_watchfn
Date: Wed, 9 Mar 2016 14:07:20 +0800 [thread overview]
Message-ID: <1457503640-31473-1-git-send-email-peterx@redhat.com> (raw)
Signed-off-by: Peter Xu <peterx@redhat.com>
---
hw/usb/dev-mtp.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index 7391783..76ad64e 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -433,12 +433,11 @@ static void inotify_watchfn(void *arg)
MTPState *s = arg;
ssize_t bytes;
/* From the man page: atleast one event can be read */
- int len = sizeof(struct inotify_event) + NAME_MAX + 1;
int pos;
- char buf[len];
+ char buf[sizeof(struct inotify_event) + NAME_MAX + 1];
for (;;) {
- bytes = read(s->inotifyfd, buf, len);
+ bytes = read(s->inotifyfd, buf, sizeof(buf));
pos = 0;
if (bytes <= 0) {
--
2.4.3
next reply other threads:[~2016-03-09 6:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-09 6:07 Peter Xu [this message]
2016-03-09 7:56 ` [Qemu-devel] [PATCH] usb: fix unbound stack warning for inotify_watchfn Paolo Bonzini
2016-03-18 12:56 ` Gerd Hoffmann
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=1457503640-31473-1-git-send-email-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=kraxel@redhat.com \
--cc=pbonzini@redhat.com \
--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).