From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ab9fs-0003Lv-Bm for qemu-devel@nongnu.org; Wed, 02 Mar 2016 11:30:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ab9fr-00015a-4x for qemu-devel@nongnu.org; Wed, 02 Mar 2016 11:30:56 -0500 References: From: Eric Blake Message-ID: <56D71535.9040008@redhat.com> Date: Wed, 2 Mar 2016 09:30:45 -0700 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jAUBHdr4i4EwD9sfjmsfbxX7nSpcq7Tfb" 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: Jeff Cody , qemu-block@nongnu.org Cc: kwolf@redhat.com, mitake.hitoshi@lab.ntt.co.jp, qemu-devel@nongnu.org, v.tolstov@selfip.ru, mreitz@redhat.com, namei.unix@gmail.com, pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --jAUBHdr4i4EwD9sfjmsfbxX7nSpcq7Tfb Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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. >=20 > 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. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --jAUBHdr4i4EwD9sfjmsfbxX7nSpcq7Tfb Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJW1xU1AAoJEKeha0olJ0NqwtAH/0EjJJXHwaJun6SBtCNmpJ5a lFEkhn5jzvQIu7AUiEgW1c4d8Nnmr/k+i376A34K9Il1u2lSKAl3oNwRatKJijEa 0HDBzDXWup/toFkG70/6M5NhQRchJ/0RSTPF7MTRAhAVmY/P2lqrxR4a/wuiRPrd YVL1V74oH8jrs/YSZ3L80FeZLFUCvr6Gxc5UmH3lGCZeKh4HdAtOT78pLJKiKD2p tG+w2fL2j7mt7N7Xd7uJWCdCdMWD6JYe5bgtkoFzAR+v4YSWLS1pXZ3sof88sfnO HVl6w73ISrygisr2AQGw3aJ6O7vCO8yJhdUULGd37ihiZPNtijJsxHwUbHwrXXw= =F9R/ -----END PGP SIGNATURE----- --jAUBHdr4i4EwD9sfjmsfbxX7nSpcq7Tfb--