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

Re: [Xen-devel] [PATCH v2 2/2] ocaml: remove undefined behaviour in systemd_stubs.c




> On 23 Jul 2018, at 11:26, Wei Liu <wei.liu2@xxxxxxxxxx> wrote:
> 
> 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>
> ---
> Cc: Christian Lindig <christian.lindig@xxxxxxxxxx>
> Cc: David Scott <dave@xxxxxxxxxx>
> 
> See: https://gitlab.com/liuw/xen/-/jobs/83628833
> ---
> 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
> -- 
> 2.11.0
> 

Acked-by: Christian Lindig <christian.lindig@xxxxxxxxxx>


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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