Skip to contentSkip to conversation

libxl: add initializers for libxl__domid_history

PATCH In review Paul Durrant 2 participants 2 messages Feb 26, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: add initializers for libxl__domid_history

This patch fixes Coverity issue CID 1459006 (Insecure data handling (INTEGER_OVERFLOW)).

The problem is that the error paths for libxl__mark_domid_recent() and libxl__is_domid_recent() check the 'f' field in struct libxl__domid_history when it may not have been initialized.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Anthony PERARD <[email protected]>

---
 tools/libxl/libxl_domain.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/libxl/libxl_domain.c +2 -2
index 8937aeb260..41d08394f3 100644
@@ -1390,7 +1390,7 @@ static int libxl__read_recent(libxl__gc *gc,
 static int libxl__mark_domid_recent(libxl__gc *gc, uint32_t domid)
 {
     libxl__flock *lock;
-    struct libxl__domid_history ctxt;
+    struct libxl__domid_history ctxt = {};
     char *new;
     FILE *nf = NULL;
     int r, rc;
@@ -1461,7 +1461,7 @@ out:
 
 int libxl__is_domid_recent(libxl__gc *gc, uint32_t domid, bool *recent)
 {
-    struct libxl__domid_history ctxt;
+    struct libxl__domid_history ctxt = {};
     int rc;
 
     rc = libxl__open_domid_history(gc, &ctxt);
Signature · 7 lines
2.20.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Paul Durrant

This patch fixes Coverity issue CID 1459006 (Insecure data handling (INTEGER_OVERFLOW)).

The problem is that the error paths for libxl__mark_domid_recent() and libxl__is_domid_recent() check the 'f' field in struct libxl__domid_history when it may not have been initialized.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel