From patchwork Fri Feb 21 14:03:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 25117 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BC9D920143 for ; Fri, 21 Feb 2014 14:03:06 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id mc6sf5446189lab.8 for ; Fri, 21 Feb 2014 06:03:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version: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=b9aI1HvUwOsI0M3JNiqbNEwPjLUxhkEFz07LHv/IkY4=; b=H8Ox7WPV/v/wWc0NwkIkNEdQ29bDtgUWD8Sz/WjLmQXsfk2EVYbi5JD9Ya2JH144wK 6SVWsHVhdRZ+v/okgZULVlHeg05PH79g9TUNE0Dy/VvBTn0PgFwraOK2M19Yjo7+PvFX sR2C+uZ6Oky2QKHQFcbNRPAXVP0As2ZeDBfSNI0pPc7XD5lZWtWl7sCqjV5ibcUmmXBl yz/ehz25ffr3wmw1W+CGcaM+UQvyfqOEhWJhC/JSnGw9n6QuDypnnfhOpV8z2KOivz68 KB6PJE+j+nTmyjMPVZHRv4RzY99UpSYSQzqYlhayOJbbJVuKvATw6L7jO9Mq0bQ3ZGvO 3WuQ== X-Gm-Message-State: ALoCoQmfwjAeOVpHm2N2/d23ettqY0+AYdbLE7wncvDhg1huHJ8zvU8d/pmaJXi3rzX/3p3DADGg X-Received: by 10.112.254.129 with SMTP id ai1mr4084159lbd.7.1392991385343; Fri, 21 Feb 2014 06:03:05 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.32.197 with SMTP id h63ls42914qgh.28.gmail; Fri, 21 Feb 2014 06:03:05 -0800 (PST) X-Received: by 10.220.110.69 with SMTP id m5mr4831858vcp.55.1392991385138; Fri, 21 Feb 2014 06:03:05 -0800 (PST) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id z15si3011922vce.147.2014.02.21.06.03.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 21 Feb 2014 06:03:05 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.178 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.178; Received: by mail-ve0-f178.google.com with SMTP id oy12so3282013veb.9 for ; Fri, 21 Feb 2014 06:03:05 -0800 (PST) X-Received: by 10.220.106.84 with SMTP id w20mr4917738vco.18.1392991385055; Fri, 21 Feb 2014 06:03:05 -0800 (PST) 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 u4csp36504vcz; Fri, 21 Feb 2014 06:03:04 -0800 (PST) X-Received: by 10.180.12.43 with SMTP id v11mr3272279wib.33.1392991383640; Fri, 21 Feb 2014 06:03:03 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id eh10si2908238wib.58.2014.02.21.06.03.03 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 21 Feb 2014 06:03:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WGqgv-0004Ci-D3; Fri, 21 Feb 2014 14:03:01 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Kevin Wolf Subject: [PATCH] hw/ide/ahci.h: Avoid shifting left into sign bit Date: Fri, 21 Feb 2014 14:03:01 +0000 Message-Id: <1392991381-16135-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.178 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: , Add 'U' suffixes to avoid undefined behaviour shifting left into the signed bit of a signed integer type. Clang's sanitizer will warn about this: hw/ide/ahci.c:1210:27: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' Signed-off-by: Peter Maydell Reviewed-by: Peter Crosthwaite --- This is the minimal patch that only changes the constants that are affected; if you'd prefer consistency across all the definitions I can do one that changes "(1 << 5)" to "(1U << 5)" &c instead. hw/ide/ahci.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/ide/ahci.h b/hw/ide/ahci.h index 20e412c..9a4064f 100644 --- a/hw/ide/ahci.h +++ b/hw/ide/ahci.h @@ -40,7 +40,7 @@ #define AHCI_PORT_PRIV_DMA_SZ (AHCI_CMD_SLOT_SZ + AHCI_CMD_TBL_AR_SZ + \ AHCI_RX_FIS_SZ) -#define AHCI_IRQ_ON_SG (1 << 31) +#define AHCI_IRQ_ON_SG (1U << 31) #define AHCI_CMD_ATAPI (1 << 5) #define AHCI_CMD_WRITE (1 << 6) #define AHCI_CMD_PREFETCH (1 << 7) @@ -61,7 +61,7 @@ /* HOST_CTL bits */ #define HOST_CTL_RESET (1 << 0) /* reset controller; self-clear */ #define HOST_CTL_IRQ_EN (1 << 1) /* global IRQ enable */ -#define HOST_CTL_AHCI_EN (1 << 31) /* AHCI enabled */ +#define HOST_CTL_AHCI_EN (1U << 31) /* AHCI enabled */ /* HOST_CAP bits */ #define HOST_CAP_SSC (1 << 14) /* Slumber capable */ @@ -69,7 +69,7 @@ #define HOST_CAP_CLO (1 << 24) /* Command List Override support */ #define HOST_CAP_SSS (1 << 27) /* Staggered Spin-up */ #define HOST_CAP_NCQ (1 << 30) /* Native Command Queueing */ -#define HOST_CAP_64 (1 << 31) /* PCI DAC (64-bit DMA) support */ +#define HOST_CAP_64 (1U << 31) /* PCI DAC (64-bit DMA) support */ /* registers for each SATA port */ #define PORT_LST_ADDR 0x00 /* command list DMA addr */ @@ -89,7 +89,7 @@ #define PORT_RESERVED 0x3c /* reserved */ /* PORT_IRQ_{STAT,MASK} bits */ -#define PORT_IRQ_COLD_PRES (1 << 31) /* cold presence detect */ +#define PORT_IRQ_COLD_PRES (1U << 31) /* cold presence detect */ #define PORT_IRQ_TF_ERR (1 << 30) /* task file error */ #define PORT_IRQ_HBUS_ERR (1 << 29) /* host bus fatal error */ #define PORT_IRQ_HBUS_DATA_ERR (1 << 28) /* host bus data error */ @@ -151,7 +151,7 @@ #define PORT_IRQ_STAT_HBDS (1 << 28) /* Host Bus Data Error Status */ #define PORT_IRQ_STAT_HBFS (1 << 29) /* Host Bus Fatal Error Status */ #define PORT_IRQ_STAT_TFES (1 << 30) /* Task File Error Status */ -#define PORT_IRQ_STAT_CPDS (1 << 31) /* Code Port Detect Status */ +#define PORT_IRQ_STAT_CPDS (1U << 31) /* Code Port Detect Status */ /* ap->flags bits */ #define AHCI_FLAG_NO_NCQ (1 << 24)