From patchwork Wed Mar 9 06:07:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 594842 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1DC67140BAC for ; Wed, 9 Mar 2016 17:07:57 +1100 (AEDT) Received: from localhost ([::1]:39296 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adXHn-0000Ou-63 for incoming@patchwork.ozlabs.org; Wed, 09 Mar 2016 01:07:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59960) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adXHZ-0008W4-NE for qemu-devel@nongnu.org; Wed, 09 Mar 2016 01:07:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adXHT-00058h-IO for qemu-devel@nongnu.org; Wed, 09 Mar 2016 01:07:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55087) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adXHT-00058d-D8 for qemu-devel@nongnu.org; Wed, 09 Mar 2016 01:07:35 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id D8A3813930; Wed, 9 Mar 2016 06:07:34 +0000 (UTC) Received: from pxdev.xzpeter.org.com (dhcp-14-238.nay.redhat.com [10.66.14.238]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2967SuP017171; Wed, 9 Mar 2016 01:07:30 -0500 From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 9 Mar 2016 14:07:20 +0800 Message-Id: <1457503640-31473-1-git-send-email-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 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 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Peter Xu Reviewed-by: Paolo Bonzini --- 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) {