[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [PATCH v3 1/1] block/sheepdog: fix argumen

From: Jeff Cody
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH v3 1/1] block/sheepdog: fix argument passed to qemu_strtoul()
Date: Wed, 2 Mar 2016 11:36:38 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]