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