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]
Date:	Thu, 25 Aug 2011 00:23:35 +0900
From:	Namjae Jeon <linkinjeon@...il.com>
To:	linux-arch@...r.kernel.org, arnd@...db.de
Cc:	linux-kernel@...r.kernel.org, Namjae Jeon <linkinjeon@...il.com>
Subject: [PATCH] include: Fix compile warning in include/linux/bitops.h

The compile warning is caused by __const_hweight8 when using hweight_long with -Wsign-compare option.
The reason is that the default return value of this macro is signed. So need type casting to remove warning.

Signed-off-by: Namjae Jeon <linkinjeon@...il.com>
---
 include/asm-generic/bitops/const_hweight.h |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/asm-generic/bitops/const_hweight.h b/include/asm-generic/bitops/const_hweight.h
index fa2a50b..31b7fce 100644
--- a/include/asm-generic/bitops/const_hweight.h
+++ b/include/asm-generic/bitops/const_hweight.h
@@ -4,15 +4,15 @@
 /*
  * Compile time versions of __arch_hweightN()
  */
-#define __const_hweight8(w)		\
-      (	(!!((w) & (1ULL << 0))) +	\
-	(!!((w) & (1ULL << 1))) +	\
-	(!!((w) & (1ULL << 2))) +	\
-	(!!((w) & (1ULL << 3))) +	\
-	(!!((w) & (1ULL << 4))) +	\
-	(!!((w) & (1ULL << 5))) +	\
-	(!!((w) & (1ULL << 6))) +	\
-	(!!((w) & (1ULL << 7)))	)
+#define __const_hweight8(w)	(unsigned long)	\
+      	(	(!!((w) & (1ULL << 0))) +	\
+		(!!((w) & (1ULL << 1))) +	\
+		(!!((w) & (1ULL << 2))) +	\
+		(!!((w) & (1ULL << 3))) +	\
+		(!!((w) & (1ULL << 4))) +	\
+		(!!((w) & (1ULL << 5))) +	\
+		(!!((w) & (1ULL << 6))) +	\
+		(!!((w) & (1ULL << 7)))	)
 
 #define __const_hweight16(w) (__const_hweight8(w)  + __const_hweight8((w)  >> 8 ))
 #define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
-- 
1.7.4.4

--
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