Blob Blame History Raw
From a1af99a1129058f2aa312e3c9d125f5bc7693912 Mon Sep 17 00:00:00 2001
Message-Id: <a1af99a1129058f2aa312e3c9d125f5bc7693912@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Wed, 7 Oct 2020 18:45:37 +0200
Subject: [PATCH] numa_conf: Make virDomainNumaSetNodeCpumask() return void
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

There is only one caller of virDomainNumaSetNodeCpumask() which
checks for the return value but because the function will return
NULL iff the @cpumask was NULL in the first place. But in that
place @cpumask can't be NULL because it was just allocated by
virBitmapParse().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
(cherry picked from commit 1050c6beb1f2238cd847d93eab17d658720b08e1)

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1749518

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Message-Id: <8564849f4fc4aaca69eec3d2b7e59d03234ea39f.1602087923.git.mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 src/conf/numa_conf.c | 4 +---
 src/conf/numa_conf.h | 6 +++---
 src/libxl/xen_xl.c   | 4 ++--
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index 38fcf9d9aa..c9cc8ac22e 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -1318,14 +1318,12 @@ virDomainNumaGetNodeCpumask(virDomainNumaPtr numa,
 }
 
 
-virBitmapPtr
+void
 virDomainNumaSetNodeCpumask(virDomainNumaPtr numa,
                             size_t node,
                             virBitmapPtr cpumask)
 {
     numa->mem_nodes[node].cpumask = cpumask;
-
-    return numa->mem_nodes[node].cpumask;
 }
 
 
diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h
index ce865cbfbb..6808439a7c 100644
--- a/src/conf/numa_conf.h
+++ b/src/conf/numa_conf.h
@@ -156,9 +156,9 @@ size_t virDomainNumaSetNodeDistanceCount(virDomainNumaPtr numa,
                                          size_t ndistances)
     ATTRIBUTE_NONNULL(1);
 
-virBitmapPtr virDomainNumaSetNodeCpumask(virDomainNumaPtr numa,
-                                         size_t node,
-                                         virBitmapPtr cpumask)
+void  virDomainNumaSetNodeCpumask(virDomainNumaPtr numa,
+                                  size_t node,
+                                  virBitmapPtr cpumask)
     ATTRIBUTE_NONNULL(1);
 
 /*
diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
index 91b1825399..edea30a86a 100644
--- a/src/libxl/xen_xl.c
+++ b/src/libxl/xen_xl.c
@@ -508,10 +508,10 @@ xenParseXLVnuma(virConfPtr conf,
                             goto cleanup;
                         }
 
-                        if ((virBitmapParse(vtoken, &cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0) ||
-                            (virDomainNumaSetNodeCpumask(numa, vnodeCnt, cpumask) == NULL))
+                        if (virBitmapParse(vtoken, &cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0)
                             goto cleanup;
 
+                        virDomainNumaSetNodeCpumask(numa, vnodeCnt, cpumask);
                         vcpus += virBitmapCountBits(cpumask);
 
                     } else if (STRPREFIX(str, "vdistances")) {
-- 
2.29.2