From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahxjJ-0006px-Ct for qemu-devel@nongnu.org; Mon, 21 Mar 2016 07:10:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ahxjF-0001iv-Kd for qemu-devel@nongnu.org; Mon, 21 Mar 2016 07:10:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44012) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ahxjF-0001ig-D6 for qemu-devel@nongnu.org; Mon, 21 Mar 2016 07:10:33 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 1566FC049E1B for ; Mon, 21 Mar 2016 11:10:33 +0000 (UTC) From: Gerd Hoffmann Date: Mon, 21 Mar 2016 12:10:22 +0100 Message-Id: <1458558624-6890-5-git-send-email-kraxel@redhat.com> In-Reply-To: <1458558624-6890-1-git-send-email-kraxel@redhat.com> References: <1458558624-6890-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PULL 4/6] usb: fix unbound stack warning for inotify_watchfn List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Peter Xu From: Peter Xu Signed-off-by: Peter Xu Reviewed-by: Paolo Bonzini Message-id: 1457503640-31473-1-git-send-email-peterx@redhat.com Signed-off-by: Gerd Hoffmann --- 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 62fb7cd..01c5e51 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) { -- 1.8.3.1