bitfield.h: Fix "type of reg too small for mask" test
authorPeter Zijlstra <peterz@infradead.org>
Wed, 10 Nov 2021 10:01:03 +0000 (11:01 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Jul 2022 15:25:25 +0000 (17:25 +0200)
commite89d805e77f20724b97a9a6983c4d7d7c80652f0
tree1e2351a2755eef4292867c223459b67a5f03e529
parenta86201c3ae79f3652b4a865028fc9b71a2904289
bitfield.h: Fix "type of reg too small for mask" test

[ Upstream commit bff8c3848e071d387d8b0784dc91fa49cd563774 ]

The test: 'mask > (typeof(_reg))~0ull' only works correctly when both
sides are unsigned, consider:

 - 0xff000000 vs (int)~0ull
 - 0x000000ff vs (int)~0ull

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lore.kernel.org/r/20211110101324.950210584@infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/linux/bitfield.h