提交 f34d57d3 编写于 作者: P Peter Xu 提交者: Gerd Hoffmann

usb: fix unbound stack warning for inotify_watchfn

Signed-off-by: NPeter Xu <peterx@redhat.com>
Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
Message-id: 1457503640-31473-1-git-send-email-peterx@redhat.com
Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
上级 e3d60bc7
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册