Re: [PATCH] xen: Don't crash when we fail to init caps

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

 



On Fri, Jan 20, 2012 at 05:01:48PM +0000, Daniel P. Berrange wrote:
> On Fri, Jan 20, 2012 at 05:57:34PM +0100, Guido Günther wrote:
> > by dereferencing a NULL pointer in the call to
> > virNodeSuspendGetTargetMask.
> > 
> > Only warn but Don't set an error to not overwrite an error code set by
> > xenHypervisorMakeCapabilities.
> > ---
> >  src/xen/xen_hypervisor.c |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> > 
> > diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
> > index 2bb3466..855576c 100644
> > --- a/src/xen/xen_hypervisor.c
> > +++ b/src/xen/xen_hypervisor.c
> > @@ -2764,6 +2764,10 @@ xenHypervisorMakeCapabilities(virConnectPtr conn)
> >                                                   utsname.machine,
> >                                                   cpuinfo,
> >                                                   capabilities);
> > +    if (caps == NULL) {
> > +        VIR_WARN("Failed to get host capabilities");
> > +        return NULL;
> > +    }
> 
> Shouldn't be any need for a warning there since the method
> we just called should have raised an error
The attached version omits the warning. O.k. to apply?
Cheers,
 -- Guido
>From a1f5ee7934c367ed707123c5f720d98c5f93425e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@xxxxxxxxxxx>
Date: Fri, 20 Jan 2012 08:56:39 +0100
Subject: [PATCH] xen: Don't crash when we fail to init caps

by dereferencing a NULL pointer in the call to
virNodeSuspendGetTargetMask.
---
 src/xen/xen_hypervisor.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 5e71967..b5b2328 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -2764,6 +2764,8 @@ xenHypervisorMakeCapabilities(virConnectPtr conn)
                                                  utsname.machine,
                                                  cpuinfo,
                                                  capabilities);
+    if (caps == NULL)
+        return NULL;
 
     if (virNodeSuspendGetTargetMask(&caps->host.powerMgmt) < 0)
         VIR_WARN("Failed to get host power management capabilities");
-- 
1.7.8.3

--
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]