qemu-block
[Top][All Lists]
Advanced

[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: Eric Blake
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH v3 1/1] block/sheepdog: fix argument passed to qemu_strtoul()
Date: Wed, 2 Mar 2016 09:30:45 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

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/

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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