tree: git://git.kernel.org/pub/scm/linux/kernel/git/crng/random.git jd/get_random_u32_below head: 64e577cf130af4c0a0cb0dcc9cd64de6525ab80f commit: dbc0933c6b1d8c21eb938d44038ae0ffaf930c0c [23/26] random: use rejection sampling for uniform bounded random integers config: s390-randconfig-s031-20221010 compiler: s390-linux-gcc (GCC) 12.1.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.4-39-gce1a6720-dirty # https://git.kernel.org/pub/scm/linux/kernel/git/crng/random.git/commit/?id=dbc0933c6b1d8c21eb938d44038ae0ffaf930c0c git remote add crng-random git://git.kernel.org/pub/scm/linux/kernel/git/crng/random.git git fetch --no-tags crng-random jd/get_random_u32_below git checkout dbc0933c6b1d8c21eb938d44038ae0ffaf930c0c # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=s390 SHELL=/bin/bash fs/ext4/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot sparse warnings: (new ones prefixed by >>) fs/ext4/super.c: note: in included file (through include/linux/nodemask.h, include/linux/mmzone.h, include/linux/gfp.h, ...): >> include/linux/random.h:64:77: sparse: sparse: cast truncates bits from constant value (5dc becomes dc) >> include/linux/random.h:64:77: sparse: sparse: cast truncates bits from constant value (5dc becomes dc) vim +64 include/linux/random.h 53 54 u32 __get_random_u32_below(u32 ceil); 55 /* Returns a random integer in the interval [0, ceil), with uniform distribution. */ 56 static inline u32 get_random_u32_below(u32 ceil) 57 { 58 if (!__builtin_constant_p(ceil)) 59 return __get_random_u32_below(ceil); 60 61 for (;;) { 62 if (ceil <= 1U << 8) { 63 u32 mult = ceil * get_random_u8(); > 64 if (is_power_of_2(ceil) || (u8)mult >= -(__force u8)ceil % ceil) 65 return mult >> 8; 66 } else if (ceil <= 1U << 16) { 67 u32 mult = ceil * get_random_u16(); 68 if (is_power_of_2(ceil) || (u16)mult >= -(__force u16)ceil % ceil) 69 return mult >> 16; 70 } else { 71 u64 mult = (u64)ceil * get_random_u32(); 72 if (is_power_of_2(ceil) || (u32)mult >= -ceil % ceil) 73 return mult >> 32; 74 } 75 } 76 } 77 -- 0-DAY CI Kernel Test Service https://01.org/lkp