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>] [day] [month] [year] [list]
Date:	Mon, 20 Jun 2011 17:08:21 +0900
From:	NamJae Jeon <linkinjeon@...il.com>
To:	linux-kernel@...r.kernel.org, arnd@...db.de,
	linux-arch@...r.kernel.org
Subject: WARNING:'hweight_long' include/linux/bitops.h compile warning problem.

Hello. Arnd

I found compile warning while compiling module when using -Wsign-compare option.

include/linux/bitops.h: In function 'hweight_long':
include/linux/bitops.h:49: warning: signed and unsigned type in
conditional expression

I found the reason of this problem that the default return value of
the below macro is signed.

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

So, I try to add (unsigned long) in __const_hweight8 like this.

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

so, I can't see compile warning after fixing it, Would you plz check this ?

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