Re: UBSAN: Undefined behaviour in ./arch/arm/include/asm/bitops.h

From: Russell King - ARM Linux
Date: Sat Sep 24 2016 - 05:15:41 EST


On Sat, Sep 24, 2016 at 01:45:33PM +0900, Seung-Woo Kim wrote:
> With the patch "arm: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL", I got
> following UBSAN warning on Exynos5422 SoC board.

Well, the simple solution is to have fls() and ffs() take unsigned int
arguments rather than ints - but the question that brings up is: why
do both of these take signed ints? It seems at least to me that it
would be more sensible for these to take unsigned int, or even
unsigned long like the other bitops do.

--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.