From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54442) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adYyu-0007xT-2d for qemu-devel@nongnu.org; Wed, 09 Mar 2016 02:56:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adYyq-0005oI-T8 for qemu-devel@nongnu.org; Wed, 09 Mar 2016 02:56:32 -0500 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:33352) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adYyq-0005o8-Me for qemu-devel@nongnu.org; Wed, 09 Mar 2016 02:56:28 -0500 Received: by mail-wm0-x236.google.com with SMTP id l68so180898096wml.0 for ; Tue, 08 Mar 2016 23:56:28 -0800 (PST) Sender: Paolo Bonzini References: <1457503640-31473-1-git-send-email-peterx@redhat.com> From: Paolo Bonzini Message-ID: <56DFD72A.3080408@redhat.com> Date: Wed, 9 Mar 2016 08:56:26 +0100 MIME-Version: 1.0 In-Reply-To: <1457503640-31473-1-git-send-email-peterx@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] usb: fix unbound stack warning for inotify_watchfn List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Xu , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, kraxel@redhat.com On 09/03/2016 07:07, Peter Xu wrote: > - 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)); sizeof is good here, since read takes a size in bytes. Reviewed-by: Paolo Bonzini