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

Re: [Xen-devel] [PATCH 5/5] libxl: Add explicit cast to libxl_psr_cat_set_cbm



On Mon, 2015-12-28 at 00:16 -0500, Joshua Otto wrote:
> From: Chester Lin <czylin@xxxxxxxxxxxx>
> 
> Fixes Coverity CID 1343299. The call to xc_psr_cat_set_domain_data()
> expects type xc_psr_cat_type but is provided libxl_psr_cbm_type which
> is defined in IDL.

I assume the values are the same by construction in the IDL? Assuming so
then it would be worth mentioning that here I think, so we know why we
thought this was a valid change.

>  This change adds an explicit cast to fix the
> Coverity warning, and tweaks the surrounding code to more closely
> conform to the guidelines in CODING_STYLE.
> 
> No functional changes.
> 
> Signed-off-by: Chester Lin <czylin@xxxxxxxxxxxx>
> ---
> Âtools/libxl/libxl_psr.c | 15 ++++++++++-----
> Â1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/libxl/libxl_psr.c b/tools/libxl/libxl_psr.c
> index 3d0dc61..1677f9c 100644
> --- a/tools/libxl/libxl_psr.c
> +++ b/tools/libxl/libxl_psr.c
> @@ -298,7 +298,7 @@ int libxl_psr_cat_set_cbm(libxl_ctx *ctx, uint32_t
> domid,
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂuint64_t cbm)
> Â{
> ÂÂÂÂÂGC_INIT(ctx);
> -ÂÂÂÂint rc;
> +ÂÂÂÂint rc, r;
> ÂÂÂÂÂint socketid, nr_sockets;
> Â
> ÂÂÂÂÂrc = libxl__count_physical_sockets(gc, &nr_sockets);
> @@ -310,7 +310,9 @@ int libxl_psr_cat_set_cbm(libxl_ctx *ctx, uint32_t
> domid,
> ÂÂÂÂÂlibxl_for_each_set_bit(socketid, *target_map) {
> ÂÂÂÂÂÂÂÂÂif (socketid >= nr_sockets)
> ÂÂÂÂÂÂÂÂÂÂÂÂÂbreak;
> -ÂÂÂÂÂÂÂÂif (xc_psr_cat_set_domain_data(ctx->xch, domid, type, socketid,
> cbm)) {
> +ÂÂÂÂÂÂÂÂr = xc_psr_cat_set_domain_data(ctx->xch, domid,
> (xc_psr_cat_type) type,
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂsocketid, cbm);
> +ÂÂÂÂÂÂÂÂif (r) {
> ÂÂÂÂÂÂÂÂÂÂÂÂÂlibxl__psr_cat_log_err_msg(gc, errno);
> ÂÂÂÂÂÂÂÂÂÂÂÂÂrc = ERROR_FAIL;
> ÂÂÂÂÂÂÂÂÂ}
> @@ -326,11 +328,14 @@ int libxl_psr_cat_get_cbm(libxl_ctx *ctx, uint32_t
> domid,
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂuint64_t *cbm_r)
> Â{
> ÂÂÂÂÂGC_INIT(ctx);
> -ÂÂÂÂint rc = 0;
> -
> -ÂÂÂÂif (xc_psr_cat_get_domain_data(ctx->xch, domid, type, target,
> cbm_r)) {
> +ÂÂÂÂint rc, r;
> +ÂÂÂÂr = xc_psr_cat_get_domain_data(ctx->xch, domid, (xc_psr_cat_type)
> type,
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂtarget, cbm_r);
> +ÂÂÂÂif (r) {
> ÂÂÂÂÂÂÂÂÂlibxl__psr_cat_log_err_msg(gc, errno);
> ÂÂÂÂÂÂÂÂÂrc = ERROR_FAIL;
> +ÂÂÂÂ} else {
> +ÂÂÂÂÂÂÂÂrc = 0;
> ÂÂÂÂÂ}
> Â
> ÂÂÂÂÂGC_FREE;
_______________________________________________
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®.