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

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

 



On Mon, Mar 14, 2011 at 09:27:40PM -0600, Eric Blake wrote:
> 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.

No, INVALID_ARG should rarely be used - it indicates that a 
parameter to a method was incorrect. Using it for this will
give horrible error messages.  Better to use CONFIG_UNSUPPORTED
for any semantic XML error.


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]