render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
c1c534
From 230fcf5bfaf2b17313fe255a09bfa79c8ea9ae8a Mon Sep 17 00:00:00 2001
c1c534
Message-Id: <230fcf5bfaf2b17313fe255a09bfa79c8ea9ae8a@dist-git>
c1c534
From: Martin Kletzander <mkletzan@redhat.com>
c1c534
Date: Wed, 31 Jan 2018 16:32:35 +0100
c1c534
Subject: [PATCH] util: Check for empty allocation instead of just NULL pointer
c1c534
c1c534
When working on the CAT series one of the changes was that the pointer got
c1c534
allocated in another part of the code, even when resctrl was not available on
c1c534
the host system.  However this one particular place neglected that so it needs
c1c534
to be fixed in order to get the proper error message when requesting
c1c534
<cachetune/> on HW with no support for it.
c1c534
c1c534
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
c1c534
(cherry picked from commit bd5d07425de504c571d6d47ace8602fa86c1a1c8)
c1c534
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
c1c534
c1c534
https://bugzilla.redhat.com/show_bug.cgi?id=1289368
c1c534
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
c1c534
---
c1c534
 src/util/virresctrl.c | 2 +-
c1c534
 1 file changed, 1 insertion(+), 1 deletion(-)
c1c534
c1c534
diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
c1c534
index 754820ee46..03218a481d 100644
c1c534
--- a/src/util/virresctrl.c
c1c534
+++ b/src/util/virresctrl.c
c1c534
@@ -1472,7 +1472,7 @@ virResctrlAllocCreate(virResctrlInfoPtr resctrl,
c1c534
     if (!alloc)
c1c534
         return 0;
c1c534
 
c1c534
-    if (!resctrl) {
c1c534
+    if (virResctrlInfoIsEmpty(resctrl)) {
c1c534
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
c1c534
                        _("Resource control is not supported on this host"));
c1c534
         return -1;
c1c534
-- 
c1c534
2.16.1
c1c534