projects
/
xen.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3bf6969
)
tools/ocaml: libxb: Harden stub_header_of_string()
author
Julien Grall
<jgrall@amazon.com>
Mon, 30 Mar 2020 13:29:10 +0000
(14:29 +0100)
committer
Julien Grall
<jgrall@amazon.com>
Mon, 20 Apr 2020 14:03:03 +0000
(15:03 +0100)
stub_header_of_string() should not modify the header. So mark the
variable 'hdr' as const.
Signed-off-by: Julien Grall <jgrall@amazon.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
tools/ocaml/libs/xb/xenbus_stubs.c
patch
|
blob
|
history
diff --git
a/tools/ocaml/libs/xb/xenbus_stubs.c
b/tools/ocaml/libs/xb/xenbus_stubs.c
index a68e783f708b4395acd9ad7764599edcbaa63dc4..001bb033710943dab6022e71e34ad3311fa7c239 100644
(file)
--- 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));