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

[Xen-changelog] [xen staging] ocaml: remove undefined behaviour in systemd_stubs.c



commit 6e2a53afa15422ee290663dbb798c085ef7068ed
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Mon Jul 23 11:26:49 2018 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Tue Jul 24 09:16:16 2018 +0100

    ocaml: remove undefined behaviour in systemd_stubs.c
    
    Clang complains:
    
    systemd_stubs.c:51:8: error: shifting a negative signed value is undefined 
[-Werror,-Wshift-negative-value]
            ret = Val_int(-1U);
                  ^~~~~~~~~~~~
    
    Since sd_notify_fd has a signature of unit -> unit, we simply change
    the return value to Val_unit.
    
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Acked-by: Christian Lindig <christian.lindig@xxxxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 tools/ocaml/xenstored/systemd_stubs.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/tools/ocaml/xenstored/systemd_stubs.c 
b/tools/ocaml/xenstored/systemd_stubs.c
index 490156c06a..31a1a5d384 100644
--- a/tools/ocaml/xenstored/systemd_stubs.c
+++ b/tools/ocaml/xenstored/systemd_stubs.c
@@ -32,13 +32,10 @@
 CAMLprim value ocaml_sd_notify_ready(value ignore)
 {
        CAMLparam1(ignore);
-       CAMLlocal1(ret);
-
-       ret = Val_int(0);
 
        sd_notify(1, "READY=1");
 
-       CAMLreturn(ret);
+       CAMLreturn(Val_unit);
 }
 
 #else
@@ -46,10 +43,7 @@ CAMLprim value ocaml_sd_notify_ready(value ignore)
 CAMLprim value ocaml_sd_notify_ready(value ignore)
 {
        CAMLparam1(ignore);
-       CAMLlocal1(ret);
-
-       ret = Val_int(-1U);
 
-       CAMLreturn(ret);
+       CAMLreturn(Val_unit);
 }
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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