]> git.baikalelectronics.ru Git - kernel.git/commit
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:14:18 +0000 (17:14 +0200)
commit40eb7fe697a0093175ce7af3e2ce8d07a0f46979
tree6b322686e9fb930199f3c03c83bcd6961a949059
parent1983ae27e8a67486c1f561d2a7ad701ca6a9ac24
bitfield.h: Fix "type of reg too small for mask" test

[ Upstream commit f57d58311e4a7f43fc4fa5d32f1f6d19e037c3f4 ]

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