[v7,2/6] libxl: modify libxl__logv() to only log valid domid values
diff mbox series

Message ID 20200221112049.3077-3-pdurrant@amazon.com
State New
Headers show
Series
  • xl/libxl: domid allocation/preservation changes
Related show

Commit Message

Paul Durrant Feb. 21, 2020, 11:20 a.m. UTC
Some code-paths use values other than INVALID_DOMID to indicate an invalid
domain id. Specifically, xl will pass a value of 0 when creating/restoring
a domain. Therefore modify libxl__logv() to use libxl_domid_valid_guest()
as a validity test.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
Cc: Wei Liu <wl@xen.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>

v6:
 - New in v6 (split out from another patch)
---
 tools/libxl/libxl_internal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wei Liu Feb. 21, 2020, 12:07 p.m. UTC | #1
On Fri, Feb 21, 2020 at 11:20:45AM +0000, Paul Durrant wrote:
> Some code-paths use values other than INVALID_DOMID to indicate an invalid
> domain id. Specifically, xl will pass a value of 0 when creating/restoring
> a domain. Therefore modify libxl__logv() to use libxl_domid_valid_guest()
> as a validity test.
> 
> Signed-off-by: Paul Durrant <pdurrant@amazon.com>
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

This patch is now in staging.

Wei.

Patch
diff mbox series

diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c
index bbd4c6cba9..d93a75533f 100644
--- a/tools/libxl/libxl_internal.c
+++ b/tools/libxl/libxl_internal.c
@@ -234,7 +234,7 @@  void libxl__logv(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval,
     fileline[sizeof(fileline)-1] = 0;
 
     domain[0] = 0;
-    if (domid != INVALID_DOMID)
+    if (libxl_domid_valid_guest(domid))
         snprintf(domain, sizeof(domain), "Domain %"PRIu32":", domid);
  x:
     xtl_log(ctx->lg, msglevel, errnoval, "libxl",