[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen stable-4.13] tools/ocaml: libxb: Harden stub_header_of_string()
commit 0e904b781f05faf58243ff22b24e40492b2e4ef7 Author: Julien Grall <jgrall@xxxxxxxxxx> AuthorDate: Mon Mar 30 14:29:10 2020 +0100 Commit: Ian Jackson <iwj@xxxxxxxxxxxxxx> CommitDate: Fri Mar 19 13:41:01 2021 +0000 tools/ocaml: libxb: Harden stub_header_of_string() stub_header_of_string() should not modify the header. So mark the variable 'hdr' as const. Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx> Acked-by: Christian Lindig <christian.lindig@xxxxxxxxxx> (cherry picked from commit d92ba1aa7cf877a77abdcbd94a6a19fc55886a75) --- tools/ocaml/libs/xb/xenbus_stubs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/ocaml/libs/xb/xenbus_stubs.c b/tools/ocaml/libs/xb/xenbus_stubs.c index a68e783f70..001bb03371 100644 --- a/tools/ocaml/libs/xb/xenbus_stubs.c +++ b/tools/ocaml/libs/xb/xenbus_stubs.c @@ -40,12 +40,12 @@ CAMLprim value stub_header_of_string(value s) { CAMLparam1(s); CAMLlocal1(ret); - struct xsd_sockmsg *hdr; + const struct xsd_sockmsg *hdr; if (caml_string_length(s) != sizeof(struct xsd_sockmsg)) caml_failwith("xb header incomplete"); ret = caml_alloc_tuple(4); - hdr = (struct xsd_sockmsg *) String_val(s); + hdr = (const struct xsd_sockmsg *) String_val(s); Store_field(ret, 0, Val_int(hdr->tx_id)); Store_field(ret, 1, Val_int(hdr->req_id)); Store_field(ret, 2, Val_int(hdr->type)); -- generated by git-patchbot for /home/xen/git/xen.git#stable-4.13
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |