lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1377000932-5438-1-git-send-email-mika.westerberg@linux.intel.com>
Date:	Tue, 20 Aug 2013 15:15:32 +0300
From:	Mika Westerberg <mika.westerberg@...ux.intel.com>
To:	linux-spi@...r.kernel.org
Cc:	Mark Brown <broonie@...nel.org>,
	Stephen Warren <swarren@...dia.com>,
	Mika Westerberg <mika.westerberg@...ux.intel.com>,
	linux-kernel@...r.kernel.org
Subject: [PATCH] spi: fix SPI_BIT_MASK() to use correct size for 32-bit transfer mask

When building a 64-bit kernel we get the following warning from the
compiler:

 drivers/spi/spi-pxa2xx.c: In function ‘pxa2xx_spi_probe’:
 drivers/spi/spi-pxa2xx.c:1152:3: warning: large integer implicitly truncated to unsigned type [-Woverflow]
   master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
   ^
This is due the fact that when the max range is specified as 32
SPI_BIT_MASK() expands to ~0UL which doesn't fit to the u32 type that the
master->bits_per_word_mask is.

Fix this by using ~0U instead.

Signed-off-by: Mika Westerberg <mika.westerberg@...ux.intel.com>
---
 include/linux/spi/spi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 28e440b..c920c2f 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -309,7 +309,7 @@ struct spi_master {
 	/* bitmask of supported bits_per_word for transfers */
 	u32			bits_per_word_mask;
 #define SPI_BPW_MASK(bits) BIT((bits) - 1)
-#define SPI_BIT_MASK(bits) (((bits) == 32) ? ~0UL : (BIT(bits) - 1))
+#define SPI_BIT_MASK(bits) (((bits) == 32) ? ~0U : (BIT(bits) - 1))
 #define SPI_BPW_RANGE_MASK(min, max) (SPI_BIT_MASK(max) - SPI_BIT_MASK(min - 1))
 
 	/* other constraints relevant to this driver */
-- 
1.8.4.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ