[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] libxl: don't leave libxl_set_memory_target() return value uninitialized



On Mon, Jun 20, 2016 at 04:06:16AM -0600, Jan Beulich wrote:
> 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 <jbeulich@xxxxxxxx>
> ---
> Did Coverity not spot this yet?
> 

Yes, I already sent a patch. But no-one reviewed it yet... :-/

<1465740590-21337-1-git-send-email-wei.liu2@xxxxxxxxxx>

> --- 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 <jbeulich@xxxxxxxx>
> ---
> 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@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.