Skip to contentSkip to conversation

libxl: check return value of libxl_vcpu_setaffinity

PATCH Superseded Wei Liu 2 participants 3 messages Apr 8, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 libxl: check return value of libxl_vcpu_setaffinity

That function can fail.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Dario Faggioli <[email protected]>
---
 tools/libxl/libxl_dom.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tools/libxl/libxl_dom.c +6 -2
index a88db69..bc2e596 100644
@@ -468,8 +468,12 @@ static int set_vnuma_affinity(libxl__gc *gc, uint32_t domid,
             goto out;
         }
 
-        libxl_for_each_set_bit(j, v->vcpus)
-            libxl_set_vcpuaffinity(CTX, domid, j, NULL, &cpumap);
+        libxl_for_each_set_bit(j, v->vcpus) {
+            rc = libxl_set_vcpuaffinity(CTX, domid, j, NULL, &cpumap);
+            if (rc) {
+                LOG(ERROR, "Can't set cpu affinity for %d", j);
+                goto out;
+        }
     }
 
 out:
Signature · 1 line
1.9.1
#1 lore raw

Wei Liu writes ("[PATCH] libxl: check return value of libxl_vcpu_setaffinity"):

Quoted 1 line

That function can fail.

...

tools/libxl/libxl_dom.c static int set_vnuma_affinity(libxl__gc *gc, uint32_t domid, · line 477

Quoted 11 lines
         }
tools/libxl/libxl_dom.c +6 -2
-        libxl_for_each_set_bit(j, v->vcpus)
-            libxl_set_vcpuaffinity(CTX, domid, j, NULL, &cpumap);
+        libxl_for_each_set_bit(j, v->vcpus) {
+            rc = libxl_set_vcpuaffinity(CTX, domid, j, NULL, &cpumap);
+            if (rc) {
+                LOG(ERROR, "Can't set cpu affinity for %d", j);
+                goto out;
+        }
     }

Does this not have a missing `}' ?

Ian.

author
#2 lore raw
Quoted 15 lines · Ian Jackson

Wei Liu writes ("[PATCH] libxl: check return value of libxl_vcpu_setaffinity"):

Quoted 1 line

That function can fail.

...

tools/libxl/libxl_dom.c static int set_vnuma_affinity(libxl__gc *gc, uint32_t domid, · line 477

Quoted 11 lines
         }
tools/libxl/libxl_dom.c +6 -2
-        libxl_for_each_set_bit(j, v->vcpus)
-            libxl_set_vcpuaffinity(CTX, domid, j, NULL, &cpumap);
+        libxl_for_each_set_bit(j, v->vcpus) {
+            rc = libxl_set_vcpuaffinity(CTX, domid, j, NULL, &cpumap);
+            if (rc) {
+                LOG(ERROR, "Can't set cpu affinity for %d", j);
+                goto out;
+        }
     }
Quoted 2 lines

Does this not have a missing `}' ?

Yes, you're right. I will resend.

Wei.

Quoted 1 line

Ian.