]> www.infradead.org Git - users/willy/linux.git/commit
fls: change parameter to unsigned int
authorMatthew Wilcox <willy@infradead.org>
Wed, 5 Dec 2018 00:14:06 +0000 (11:14 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 6 Dec 2018 22:08:58 +0000 (09:08 +1100)
commit5d8a8fd79ed7f78dce3d5d55721fec684ed77b34
treeb9a532f1b6cf8781f68ae9ba282cffe7abb9b3d8
parent5499787dd6a4c62fac96623030fa9caed3d3c6fe
fls: change parameter to unsigned int

When testing in userspace, UBSAN pointed out that shifting into the sign
bit is undefined behaviour.  It doesn't really make sense to ask for the
highest set bit of a negative value, so just turn the argument type into
an unsigned int.

Some architectures (eg ppc) already had it declared as an unsigned int, so
I don't expect too many problems.

Link: http://lkml.kernel.org/r/20181105221117.31828-1-willy@infradead.org
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
16 files changed:
arch/alpha/include/asm/bitops.h
arch/arc/include/asm/bitops.h
arch/c6x/include/asm/bitops.h
arch/csky/include/asm/bitops.h
arch/hexagon/include/asm/bitops.h
arch/ia64/include/asm/bitops.h
arch/m68k/include/asm/bitops.h
arch/mips/include/asm/bitops.h
arch/openrisc/include/asm/bitops/fls.h
arch/parisc/include/asm/bitops.h
arch/s390/include/asm/bitops.h
arch/unicore32/include/asm/bitops.h
arch/x86/include/asm/bitops.h
include/asm-generic/bitops/builtin-fls.h
include/asm-generic/bitops/fls.h
tools/include/asm-generic/bitops/fls.h