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

[xen staging] tools/ocaml: libxc: Check error return in stub_xc_vcpu_context_get()

commit 3bf69699cacad3efb4fe6109044365f79379ed20
Author:     Julien Grall <jgrall@xxxxxxxxxx>
AuthorDate: Sun Mar 29 20:12:34 2020 +0100
Commit:     Julien Grall <jgrall@xxxxxxxxxx>
CommitDate: Mon Apr 20 15:02:17 2020 +0100

    tools/ocaml: libxc: Check error return in stub_xc_vcpu_context_get()
    xc_vcpu_getcontext() may fail to retrieve the vcpu context. Rather than
    ignoring the return value, check it and throw an error if needed.
    Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>
    Acked-by: Christian Lindig <christian.lindig@xxxxxxxxxx>
 tools/ocaml/libs/xc/xenctrl_stubs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c 
index 904da45c4f..0fdbeac158 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -497,6 +497,8 @@ CAMLprim value stub_xc_vcpu_context_get(value xch, value 
        vcpu_guest_context_any_t ctxt;
        ret = xc_vcpu_getcontext(_H(xch), _D(domid), Int_val(cpu), &ctxt);
+       if ( ret < 0 )
+               failwith_xc(_H(xch));
        context = caml_alloc_string(sizeof(ctxt));
        memcpy(String_val(context), (char *) &ctxt.c, sizeof(ctxt.c));
generated by git-patchbot for /home/xen/git/xen.git#staging



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.