libxl: don't leave libxl_set_memory_target() return value uninitialized
PATCH 1/1 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.
---
Did Coverity not spot this yet?
tools/libxl/libxl.c +3 -1
@@ -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, ¤t_target_memkb, ¤t_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.
---
Did Coverity not spot this yet?
tools/libxl/libxl.c +3 -1
@@ -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, ¤t_target_memkb, ¤t_max_memkb);if (lrc <0 ) { rc =ERROR_FAIL ; goto out_no_transaction; }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 10 lines · Jan Beulich
Commit
ecdc6fd878("libxl: Fixlibxl_set_memory_targetreturn value") deliberately made rc an uninitialized variable, but left a code path in place where the variable doesn't get initialized. UseERROR_INVALin this case to match behavior prior to that patch; arguablyERROR_FAILmight be more appropriate.Signed-off-by Jan Beulich <[email protected]>---
Did Coverity not spot this yet?
Yes, I already sent a patch. But no-one reviewed it yet... :-/
Quoted 34 lines
tools/libxl/libxl.c +3
-1@@ -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, ¤t_target_memkb, ¤t_max_memkb);if (lrc <0 ) { rc =ERROR_FAIL ; goto out_no_transaction; }libxl: don't leave
libxl_set_memory_target()return value uninitializedCommit
ecdc6fd878("libxl: Fixlibxl_set_memory_targetreturn value") deliberately made rc an uninitialized variable, but left a code path in place where the variable doesn't get initialized. UseERROR_INVALin this case to match behavior prior to that patch; arguablyERROR_FAILmight be more appropriate.Signed-off-by Jan Beulich <[email protected]>---
Did Coverity not spot this yet?tools/libxl/libxl.c +0
-0@@ -4927,8 +4927,10 @@ retry_transaction:
tools/libxl/libxl.c retry_transaction: · line 4936
Quoted 10 lines
tools/libxl/libxl.c +3
-1target =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, ¤t_target_memkb, ¤t_max_memkb);if (lrc <0 ) { rc =ERROR_FAIL ; goto out_no_transaction; }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel