[libvirt] [PATCH v2] qemu: Check the unsigned integer overflow

Osier Yang jyang at redhat.com
Tue Mar 15 03:51:41 UTC 2011


于 2011年03月15日 11:27, Eric Blake 写道:
> On 03/09/2011 01:34 AM, Osier Yang wrote:
>> As perhaps other hypervisor drivers use different capacity units,
>> do the checking in qemu driver instead of in conf/domain_conf.c.
>> ---
>>   src/qemu/qemu_command.c |   14 ++++++++++++++
>>   1 files changed, 14 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
>> index 198a4e2..59fd2ac 100644
>> --- a/src/qemu/qemu_command.c
>> +++ b/src/qemu/qemu_command.c
>> @@ -1933,6 +1933,13 @@ qemuBuildVideoDevStr(virDomainVideoDefPtr video,
>>       virBufferVSprintf(&buf, ",id=%s", video->info.alias);
>>
>>       if (video->type == VIR_DOMAIN_VIDEO_TYPE_QXL) {
>> +        if (video->vram>  (UINT_MAX / 1024)) {
>> +            qemuReportError(VIR_ERR_INTERNAL_ERROR,
>
> Wrong error.  That's a user-supplied value, so it's not an internal
> error.  Better would be VIR_ERR_INVALID_ARG.
>
>>                       if (def->videos[0]->vram&&
>>                           qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
>> +                            if (def->videos[0]->vram>  (UINT_MAX / 1024)) {
>> +                                qemuReportError(VIR_ERR_INTERNAL_ERROR,
>
> Again.
>
> ACK with those nits fixed.
>
Thanks, pushed with those nits fixed.

Regards
Osier




More information about the libvir-list mailing list