From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ab9lW-0006gz-Uf for qemu-devel@nongnu.org; Wed, 02 Mar 2016 11:36:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ab9lV-0002UM-S3 for qemu-devel@nongnu.org; Wed, 02 Mar 2016 11:36:46 -0500 Date: Wed, 2 Mar 2016 11:36:38 -0500 From: Jeff Cody Message-ID: <20160302163638.GA8345@localhost.localdomain> References: <56D71535.9040008@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56D71535.9040008@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 1/1] block/sheepdog: fix argument passed to qemu_strtoul() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: kwolf@redhat.com, qemu-block@nongnu.org, mitake.hitoshi@lab.ntt.co.jp, qemu-devel@nongnu.org, v.tolstov@selfip.ru, mreitz@redhat.com, namei.unix@gmail.com, pbonzini@redhat.com On Wed, Mar 02, 2016 at 09:30:45AM -0700, Eric Blake wrote: > On 03/02/2016 09:24 AM, Jeff Cody wrote: > > The function qemu_strtoul() reads 'unsigned long' sized data, > > which is larger than uint32_t on 64-bit machines. > > > > Even though the snap_id field in the header is 32-bits, we must > > accomodate the full size in qemu_strtoul(). > > s/accomodate/accommodate/ Thanks, I'll fix that up when applying this patch to my block branch. > > Someday, it might be nice to write a qemu_strtoi() and qemu_strtoui() > that provide a guaranteed 32-bit result, rather than a > platform-dependent width (we already have qemu_strto[u]ll() for 64-bit > results). It's a bit tricky, since C doesn't provide a native parsing > to int, and the case for overflow detection is different on 32-bit > machines than on 64-bit machines (libvirt took a couple of tries before > getting something that worked correctly), but would probably be worth it > in the long run. > > But that idea doesn't have to hold up this patch. > > -- > Eric Blake eblake redhat com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org >