]> git.proxmox.com Git - mirror_ubuntu-jammy-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)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 16 Sep 2022 08:53:28 +0000 (10:53 +0200)
commitec9d4e89b8761f2cdc8d68dfb7dd3a3576cad261
tree7d2162bcdbaa505d2fab7e52d23b1724e3c6a85b
parent439051b92f62098f3c28f223b0e390f4755c71bb
bitfield.h: Fix "type of reg too small for mask" test

BugLink: https://bugs.launchpad.net/bugs/1988479
[ 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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
include/linux/bitfield.h