[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 6/8] tools/ocaml: libxb: Harden stub_header_of_string()
From: Julien Grall <jgrall@xxxxxxxxxx> stub_header_of_string() should not modify the header. So mark the variable 'hdr' as const. Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx> --- 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)); -- 2.17.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |