Commit ecdc6fd878 ("libxl: Fix libxl_set_memory_target return value")
deliberately made rc an uninitialized variable, but left a code path in
place where the variable doesn't get initialized. Use ERROR_INVAL in
this case to match behavior prior to that patch; arguably ERROR_FAIL
might be more appropriate.

Signed-off-by: Jan Beulich <jbeul...@suse.com>
---
Did Coverity not spot this yet?

--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -4927,8 +4927,10 @@ retry_transaction:
 
     target = libxl__xs_read(gc, t, GCSPRINTF("%s/memory/target", dompath));
     if (!target && !domid) {
-        if (!xs_transaction_end(ctx->xsh, t, 1))
+        if (!xs_transaction_end(ctx->xsh, t, 1)) {
+            rc = ERROR_INVAL;
             goto out_no_transaction;
+        }
         lrc = libxl__fill_dom0_memory_info(gc, &current_target_memkb,
                                           &current_max_memkb);
         if (lrc < 0) { rc = ERROR_FAIL; goto out_no_transaction; }



libxl: don't leave libxl_set_memory_target() return value uninitialized

Commit ecdc6fd878 ("libxl: Fix libxl_set_memory_target return value")
deliberately made rc an uninitialized variable, but left a code path in
place where the variable doesn't get initialized. Use ERROR_INVAL in
this case to match behavior prior to that patch; arguably ERROR_FAIL
might be more appropriate.

Signed-off-by: Jan Beulich <jbeul...@suse.com>
---
Did Coverity not spot this yet?

--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -4927,8 +4927,10 @@ retry_transaction:
 
     target = libxl__xs_read(gc, t, GCSPRINTF("%s/memory/target", dompath));
     if (!target && !domid) {
-        if (!xs_transaction_end(ctx->xsh, t, 1))
+        if (!xs_transaction_end(ctx->xsh, t, 1)) {
+            rc = ERROR_INVAL;
             goto out_no_transaction;
+        }
         lrc = libxl__fill_dom0_memory_info(gc, &current_target_memkb,
                                           &current_max_memkb);
         if (lrc < 0) { rc = ERROR_FAIL; goto out_no_transaction; }
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to