From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHh9K-0000wT-0u for qemu-devel@nongnu.org; Tue, 21 Jul 2015 19:40:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZHh9E-0007BN-3H for qemu-devel@nongnu.org; Tue, 21 Jul 2015 19:40:37 -0400 Received: from e19.ny.us.ibm.com ([129.33.205.209]:57845) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHh9D-0007Aq-SJ for qemu-devel@nongnu.org; Tue, 21 Jul 2015 19:40:31 -0400 Received: from /spool/local by e19.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 21 Jul 2015 19:40:31 -0400 From: Michael Roth Date: Tue, 21 Jul 2015 18:40:16 -0500 Message-Id: <1437522016-23226-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH for-2.4] spapr_drc: fix clang -fsanitizer=shift warning List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, qemu-ppc@nongnu.org, agraf@suse.de Current code for generating DRC type mask generates the following warning with clang -fsanitizer=undefined -fsanitizer=shift: runtime error: left shift of negative value -1 Fix this by calculating the mask like a sane person would. Signed-off-by: Michael Roth --- hw/ppc/spapr_drc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index ee87432..0e7d725 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -32,7 +32,7 @@ #define DRC_CONTAINER_PATH "/dr-connector" #define DRC_INDEX_TYPE_SHIFT 28 -#define DRC_INDEX_ID_MASK (~(~0 << DRC_INDEX_TYPE_SHIFT)) +#define DRC_INDEX_ID_MASK ((1 << DRC_INDEX_TYPE_SHIFT) - 1) static sPAPRDRConnectorTypeShift get_type_shift(sPAPRDRConnectorType type) { -- 1.9.1