[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 5/5] libxl: Add explicit cast to libxl_psr_cat_set_cbm
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. The two enums are deliberately identical and IDL only exists so that libxl clients don't need to include libxc headers directly. 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> --- Changed commit message to say that the enums are identical --- 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; -- 1.9.5.msysgit.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |