From patchwork Fri Aug 23 16:35:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 19497 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 56839248E6 for ; Fri, 23 Aug 2013 16:35:50 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id bv4sf664459qab.4 for ; Fri, 23 Aug 2013 09:35:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=BTwMNzyqbhnRXNtYVjC16AHv9YabRf3L73FoQWGWpcY=; b=Lr+TUsntNdwo8hD7Hm8DE4bqeOpWPtOG/U0A/O6D2IjkFj38ML4rfaUOS5iKmBKOf7 dWg9PUdGc14+LsGdHq60HaOOev8d7J/7tjuSZSA7qQmDoE2v0phInmVYCSZaxKNlVMpl ztJZKm5pO8f23qYL/a7RSddPTtXUuwR96W8jgZlfmbwLstSCgjyWn9iU4X+QkDH79wf1 m2AVs2HC1FsURZTWy0bD9/5Ebjn6iCC1o0ah8e7k60kwJ6k08wrxWWYUVMxEVui5bbAj pQypnZquP/jitRIyDsBW9L63YbR6yvXciPXlRGrFXSOFTp7zvT14Y3EZbrkdKB/sXly/ 2XFA== X-Received: by 10.236.7.130 with SMTP id 2mr242606yhp.4.1377275749798; Fri, 23 Aug 2013 09:35:49 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.26.70 with SMTP id j6ls1697124qeg.94.gmail; Fri, 23 Aug 2013 09:35:49 -0700 (PDT) X-Received: by 10.52.230.131 with SMTP id sy3mr217765vdc.35.1377275749617; Fri, 23 Aug 2013 09:35:49 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id ya5si180843vec.95.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Aug 2013 09:35:49 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id d10so593422vea.19 for ; Fri, 23 Aug 2013 09:35:49 -0700 (PDT) X-Gm-Message-State: ALoCoQkbBxrYlTCICEHaerSqZ9Q1ZvMeZI4zBEdi75v2Lfqh7aQonqBK9SeHxkOf0cXt5EHtdZr9 X-Received: by 10.220.112.132 with SMTP id w4mr257394vcp.28.1377275749262; Fri, 23 Aug 2013 09:35:49 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp102780vcz; Fri, 23 Aug 2013 09:35:48 -0700 (PDT) X-Received: by 10.180.205.236 with SMTP id lj12mr407257wic.22.1377275748131; Fri, 23 Aug 2013 09:35:48 -0700 (PDT) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id r11si319086wik.49.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 23 Aug 2013 09:35:48 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1VCuKv-0002Kh-Ga; Fri, 23 Aug 2013 17:35:45 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Kevin Wolf , Stefan Hajnoczi Subject: [PATCH] block/qcow2.h: Avoid "1LL << 63" (shifts into sign bit) Date: Fri, 23 Aug 2013 17:35:45 +0100 Message-Id: <1377275745-8942-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The expression "1LL << 63" tries to shift the 1 into the sign bit of a 'long long', which provokes a clang sanitizer warning: runtime error: left shift of 1 by 63 places cannot be represented in type 'long long' Use "1ULL << 63" as the definition of QCOW_OFLAG_COPIED instead to avoid this. For consistency, we also update the other QCOW_OFLAG definitions to use the ULL suffix rather than LL, though only the shift by 63 is undefined behaviour. Signed-off-by: Peter Maydell Reviewed-by: Eric Blake --- block/qcow2.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/qcow2.h b/block/qcow2.h index dba9771..365a17e 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -40,11 +40,11 @@ #define QCOW_MAX_CRYPT_CLUSTERS 32 /* indicate that the refcount of the referenced cluster is exactly one. */ -#define QCOW_OFLAG_COPIED (1LL << 63) +#define QCOW_OFLAG_COPIED (1ULL << 63) /* indicate that the cluster is compressed (they never have the copied flag) */ -#define QCOW_OFLAG_COMPRESSED (1LL << 62) +#define QCOW_OFLAG_COMPRESSED (1ULL << 62) /* The cluster reads as all zeros */ -#define QCOW_OFLAG_ZERO (1LL << 0) +#define QCOW_OFLAG_ZERO (1ULL << 0) #define REFCOUNT_SHIFT 1 /* refcount size is 2 bytes */