[PATCH 28/33] libxl: abort() on failure of libxl_cpu_bitmap_alloc()

Peter Krempa pkrempa at redhat.com
Wed Feb 24 16:17:03 UTC 2021


Attempting to report error in case when we ran out of memory is
pointless.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/libxl/libxl_conf.c   | 6 ++----
 src/libxl/libxl_driver.c | 7 +++----
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index f8db118996..f2bcd77a29 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -854,10 +854,8 @@ libxlMakeVnumaList(virDomainDefPtr def,
             goto cleanup;

         libxl_bitmap_init(&vcpu_bitmap);
-        if (libxl_cpu_bitmap_alloc(ctx, &vcpu_bitmap, b_info->max_vcpus)) {
-            virReportOOMError();
-            goto cleanup;
-        }
+        if (libxl_cpu_bitmap_alloc(ctx, &vcpu_bitmap, b_info->max_vcpus))
+            abort();

         do {
             libxl_bitmap_set(&vcpu_bitmap, cpu);
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 75a8d46af0..434959d694 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -4931,10 +4931,9 @@ libxlDomainGetNumaParameters(virDomainPtr dom,
             if (numnodes <= 0)
                 goto cleanup;

-            if (libxl_node_bitmap_alloc(cfg->ctx, &nodemap, 0)) {
-                virReportOOMError();
-                goto cleanup;
-            }
+            if (libxl_node_bitmap_alloc(cfg->ctx, &nodemap, 0))
+                abort();
+
             nodes = virBitmapNew(numnodes);

             rc = libxl_domain_get_nodeaffinity(cfg->ctx,
-- 
2.29.2




More information about the libvir-list mailing list