From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50085) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adWbW-0002Vh-QW for qemu-devel@nongnu.org; Wed, 09 Mar 2016 00:24:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adWbT-0002h3-Lh for qemu-devel@nongnu.org; Wed, 09 Mar 2016 00:24:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39095) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adWbT-0002gz-G2 for qemu-devel@nongnu.org; Wed, 09 Mar 2016 00:24:11 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 3172F804E3 for ; Wed, 9 Mar 2016 05:24:11 +0000 (UTC) Date: Wed, 9 Mar 2016 13:23:58 +0800 From: Peter Xu Message-ID: <20160309052358.GN2377@pxdev.xzpeter.org> References: <1457420446-25276-1-git-send-email-peterx@redhat.com> <1457420446-25276-6-git-send-email-peterx@redhat.com> <56DEC3FB.2070202@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <56DEC3FB.2070202@redhat.com> Subject: Re: [Qemu-devel] [PATCH 5/8] usb: fix unbounded stack for inotify_watchfn List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, Gerd Hoffmann On Tue, Mar 08, 2016 at 01:22:19PM +0100, Paolo Bonzini wrote: > > for (;;) { > > - bytes = read(s->inotifyfd, buf, len); > > + bytes = read(s->inotifyfd, buf, __BUF_LEN); > > Again, here you can use ARRAY_SIZE(buf) and avoid the macro. Yes, will fix. Thanks! Peter