All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH] libxl: add initializers for libxl__domid_history
@ 2020-02-26 13:12 Paul Durrant
  2020-02-26 16:54 ` Wei Liu
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Durrant @ 2020-02-26 13:12 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Paul Durrant, Ian Jackson, Wei Liu

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.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wl@xen.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>
---
 tools/libxl/libxl_domain.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_domain.c b/tools/libxl/libxl_domain.c
index 8937aeb260..41d08394f3 100644
--- a/tools/libxl/libxl_domain.c
+++ b/tools/libxl/libxl_domain.c
@@ -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);
-- 
2.20.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Xen-devel] [PATCH] libxl: add initializers for libxl__domid_history
  2020-02-26 13:12 [Xen-devel] [PATCH] libxl: add initializers for libxl__domid_history Paul Durrant
@ 2020-02-26 16:54 ` Wei Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Wei Liu @ 2020-02-26 16:54 UTC (permalink / raw)
  To: Paul Durrant; +Cc: Anthony PERARD, xen-devel, Ian Jackson, Wei Liu

On Wed, Feb 26, 2020 at 01:12:13PM +0000, Paul Durrant wrote:
> 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.
> 
> Signed-off-by: Paul Durrant <pdurrant@amazon.com>

Acked-by: Wei Liu <wl@xen.org>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-26 16:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-26 13:12 [Xen-devel] [PATCH] libxl: add initializers for libxl__domid_history Paul Durrant
2020-02-26 16:54 ` Wei Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.