On 03/06/2012 09:34 AM, Peter Krempa wrote: > On 03/06/2012 01:34 AM, Eric Blake wrote: >> Using 'unsigned long' for memory values is risky on 32-bit platforms, >> as a PAE guest can have more than 4GiB memory. Our API is >> (unfortunately) locked at 'unsigned long' and a scale of 1024, but >> the rest of our system should consistently use 64-bit values, >> especially since the previous patch centralized overflow checking. >> >> +++ b/src/xenxs/xen_sxpr.c >> @@ -1101,9 +1133,15 @@ cleanup: >> >> >> static >> -int xenXMConfigSetInt(virConfPtr conf, const char *setting, long l) { >> +int xenXMConfigSetInt(virConfPtr conf, const char *setting, long long >> l) { >> virConfValuePtr value = NULL; >> >> + if ((long) l != l) { >> + XENXS_ERROR(VIR_ERR_INTERNAL_ERROR, > > I suppose the VIR_ERR_INTERNAL_ERROR is intentional. Yes - the libvirt.c interface takes 'unsigned long', and widening that to long long should be reversible so we should never hit this error. > >> + _("integer overflow in trying to store %lld to %s"), >> + l, setting); >> + return -1; >> + } >> if (VIR_ALLOC(value)< 0) { >> virReportOOMError(); >> return -1; > > ACK, > > Peter > -- Eric Blake eblake@xxxxxxxxxx +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list