From patchwork Wed Apr 27 11:11:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 8955141 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2D02E9FC83 for ; Wed, 27 Apr 2016 11:14:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5F40A20268 for ; Wed, 27 Apr 2016 11:14:44 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 60D0D20279 for ; Wed, 27 Apr 2016 11:14:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1avNOn-0003jS-PG; Wed, 27 Apr 2016 11:12:53 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1avNOn-0003gn-3G for xen-devel@lists.xenproject.org; Wed, 27 Apr 2016 11:12:53 +0000 Received: from [85.158.139.211] by server-12.bemta-5.messagelabs.com id D3/5B-25799-4BE90275; Wed, 27 Apr 2016 11:12:52 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGIsWRWlGSWpSXmKPExsXitHSDve6WeQr hBofusFp83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBnPD05jKtjDVXFj3k/GBsb/HF2MnBwSAv4S pw/vYQGx2QR0JC7O3cnWxcjBISKgInF7rwFImFmgWOLrqj5WEFtYIETiy4m9zCA2i4CqxL5Xu 9lAbF4BV4mlc3ayQIzUlTi5exM7iM0JFG9rmgAWFxJwkXh6+w4rRL2gxMmZT1gg5mtKtG7/zQ 5hy0s0b53NDFGvKNE/7wHYORIC3BJ/u+0nMPLPQtI9C0n3LCTdCxiZVzGqF6cWlaUW6RrqJRV lpmeU5CZm5ugaGpjq5aYWFyemp+YkJhXrJefnbmIEhl89AwPjDsamXudDjJIcTEqivAvbFcKF +JLyUyozEosz4otKc1KLDzHKcHAoSfCenguUEyxKTU+tSMvMAUYCTFqCg0dJhLd+DlCat7ggM bc4Mx0idYpRUUqcNxGkTwAkkVGaB9cGi75LjLJSwryMDAwMQjwFqUW5mSWo8q8YxTkYlYR5D4 BM4cnMK4Gb/gpoMRPQ4suHZEEWlyQipKQaGPWnmv3wrzmkZuT3Y++iWs8NX0tnddWUyz57E7Z eZ3Hs3QKhu2ev6lu6Hdp/4GlUlWvWfAPVWoEtF/uvBnaUOGfudg5bZXzNf5/Wl4ZjJsoXsh+t KRQUmH+Y9ffPUu+8vcruy0/OEfhv0Bj8YbOL1/mlq1jvbpbUE7PT+CntqbK6ZpvQYiPL60osx RmJhlrMRcWJAKz6/au5AgAA X-Env-Sender: prvs=918322aae=roger.pau@citrix.com X-Msg-Ref: server-7.tower-206.messagelabs.com!1461755568!36497476!3 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 54593 invoked from network); 27 Apr 2016 11:12:51 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-7.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 27 Apr 2016 11:12:51 -0000 X-IronPort-AV: E=Sophos;i="5.24,541,1454976000"; d="scan'208";a="356738751" From: Roger Pau Monne To: Date: Wed, 27 Apr 2016 13:11:52 +0200 Message-ID: <1461755514-23754-15-git-send-email-roger.pau@citrix.com> X-Mailer: git-send-email 2.6.4 (Apple Git-63) In-Reply-To: <1461755514-23754-1-git-send-email-roger.pau@citrix.com> References: <1461755514-23754-1-git-send-email-roger.pau@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Wei Liu , Ian Jackson , Roger Pau Monne Subject: [Xen-devel] [PATCH v3 for-4.7 14/16] oxenstored: fix error when shifting negative value X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP By explicitly casting it to unsigned. Reasoning on why this is needed, provided by Andrew Cooper: "Ocaml stores integers shifted left by one, and with the bottom bit set. Values with the bottom bit clear are pointers into the GC'd heap. Values with the bottom bit set are integers, and need to be shifted by 1 bit to have calculations performed." Signed-off-by: Roger Pau Monné Reviewed-by: Andrew Cooper Acked-by: Wei Liu --- Cc: Ian Jackson Cc: Wei Liu --- Changes since v2: - Expand commit message with Andrew's reasoning. --- tools/ocaml/xenstored/systemd_stubs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/ocaml/xenstored/systemd_stubs.c b/tools/ocaml/xenstored/systemd_stubs.c index 1bd5dea..a78a72b 100644 --- a/tools/ocaml/xenstored/systemd_stubs.c +++ b/tools/ocaml/xenstored/systemd_stubs.c @@ -124,7 +124,7 @@ CAMLprim value ocaml_sd_listen_fds(value connect_to) CAMLparam1(connect_to); CAMLlocal1(sock_ret); - sock_ret = Val_int(-1); + sock_ret = Val_int(-1U); CAMLreturn(sock_ret); } @@ -144,7 +144,7 @@ CAMLprim value ocaml_sd_notify_ready(value ignore) CAMLparam1(ignore); CAMLlocal1(ret); - ret = Val_int(-1); + ret = Val_int(-1U); CAMLreturn(ret); }