lib/tests/bitfield_kunit.c:119:13: warning: implicit conversion from 'unsigned long long' to 'unsigned int' changes value from 9223372036854775808 to 0
kernel test robot
build botHi Kees,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: be5c7bbb3a64baf884481a1ba0c2f8fb2f93f7c3 commit: 0ef71a1dc3a5355f229e2869e97de94e8e7ec7d0 [2690/5524] Merge branch 'for-next/hardening' into for-next/kspp config: powerpc-randconfig-003-20250228 (https://download.01.org/0day-ci/archive/20250228/[email protected]/config) compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250228/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from lib/tests/bitfield_kunit.c:8:
In file included from include/kunit/test.h:20:
In file included from include/linux/jump_label.h:257:
In file included from include/linux/atomic.h:7:
In file included from arch/powerpc/include/asm/atomic.h:11:
In file included from arch/powerpc/include/asm/cmpxchg.h:755:
In file included from include/asm-generic/cmpxchg-local.h:6:
In file included from include/linux/irqflags.h:18:
In file included from arch/powerpc/include/asm/irqflags.h:12:
In file included from arch/powerpc/include/asm/hw_irq.h:12:
In file included from arch/powerpc/include/asm/ptrace.h:342:
include/linux/thread_info.h:225:26: error: expected parameter declarator
225 | DECLARE_STATIC_KEY_MAYBE(CONFIG_HARDENED_USERCOPY_DEFAULT_ON,
| ^
./include/generated/autoconf.h:1888:45: note: expanded from macro 'CONFIG_HARDENED_USERCOPY_DEFAULT_ON'
1888 | #define CONFIG_HARDENED_USERCOPY_DEFAULT_ON 1
| ^
In file included from lib/tests/bitfield_kunit.c:8:
In file included from include/kunit/test.h:20:
In file included from include/linux/jump_label.h:257:
In file included from include/linux/atomic.h:7:
In file included from arch/powerpc/include/asm/atomic.h:11:
In file included from arch/powerpc/include/asm/cmpxchg.h:755:
In file included from include/asm-generic/cmpxchg-local.h:6:
In file included from include/linux/irqflags.h:18:
In file included from arch/powerpc/include/asm/irqflags.h:12:
In file included from arch/powerpc/include/asm/hw_irq.h:12:
In file included from arch/powerpc/include/asm/ptrace.h:342:
include/linux/thread_info.h:225:26: error: expected ')'
./include/generated/autoconf.h:1888:45: note: expanded from macro 'CONFIG_HARDENED_USERCOPY_DEFAULT_ON'
1888 | #define CONFIG_HARDENED_USERCOPY_DEFAULT_ON 1
| ^
include/linux/thread_info.h:225:25: note: to match this '('
225 | DECLARE_STATIC_KEY_MAYBE(CONFIG_HARDENED_USERCOPY_DEFAULT_ON,
| ^
include/linux/thread_info.h:225:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
225 | DECLARE_STATIC_KEY_MAYBE(CONFIG_HARDENED_USERCOPY_DEFAULT_ON,
| ^
| int
include/linux/thread_info.h:225:25: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
225 | DECLARE_STATIC_KEY_MAYBE(CONFIG_HARDENED_USERCOPY_DEFAULT_ON,
| ^
226 | validate_usercopy_range);
|
| void
include/linux/thread_info.h:232:6: error: call to undeclared function 'static_branch_maybe'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
232 | static_branch_maybe(CONFIG_HARDENED_USERCOPY_DEFAULT_ON,
| ^
include/linux/thread_info.h:233:6: error: use of undeclared identifier 'validate_usercopy_range'
233 | &validate_usercopy_range)) {
| ^
>> lib/tests/bitfield_kunit.c:119:13: warning: implicit conversion from 'unsigned long long' to 'unsigned int' changes value from 9223372036854775808 to 0 [-Wconstant-conversion]
119 | CHECK(u64, 0x8000000000000000ull);
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
lib/tests/bitfield_kunit.c:98:34: note: expanded from macro 'CHECK'
98 | for (v = 0; v < 1 << hweight32(mask); v++) \
| ~~~~~~~~~~^~~~~
include/asm-generic/bitops/const_hweight.h:28:89: note: expanded from macro 'hweight32'
28 | #define hweight32(w) (__builtin_constant_p(w) ? __const_hweight32(w) : __arch_hweight32(w))
| ~~~~~~~~~~~~~~~~ ^
lib/tests/bitfield_kunit.c:120:13: warning: implicit conversion from 'unsigned long long' to 'unsigned int' changes value from 9151314442816847872 to 0 [-Wconstant-conversion]
120 | CHECK(u64, 0x7f00000000000000ull);
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
lib/tests/bitfield_kunit.c:98:34: note: expanded from macro 'CHECK'
98 | for (v = 0; v < 1 << hweight32(mask); v++) \
| ~~~~~~~~~~^~~~~
include/asm-generic/bitops/const_hweight.h:28:89: note: expanded from macro 'hweight32'
28 | #define hweight32(w) (__builtin_constant_p(w) ? __const_hweight32(w) : __arch_hweight32(w))
| ~~~~~~~~~~~~~~~~ ^
lib/tests/bitfield_kunit.c:121:13: warning: implicit conversion from 'unsigned long long' to 'unsigned int' changes value from 422212465065984 to 0 [-Wconstant-conversion]
121 | CHECK(u64, 0x0001800000000000ull);
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
lib/tests/bitfield_kunit.c:98:34: note: expanded from macro 'CHECK'
98 | for (v = 0; v < 1 << hweight32(mask); v++) \
| ~~~~~~~~~~^~~~~
include/asm-generic/bitops/const_hweight.h:28:89: note: expanded from macro 'hweight32'
28 | #define hweight32(w) (__builtin_constant_p(w) ? __const_hweight32(w) : __arch_hweight32(w))
| ~~~~~~~~~~~~~~~~ ^
lib/tests/bitfield_kunit.c:125:13: warning: implicit conversion from 'unsigned long long' to 'unsigned int' changes value from 8455716864 to 4160749568 [-Wconstant-conversion]
125 | CHECK(u64, 0x0000001f8000000ull);
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
lib/tests/bitfield_kunit.c:98:34: note: expanded from macro 'CHECK'
98 | for (v = 0; v < 1 << hweight32(mask); v++) \
| ~~~~~~~~~~^~~~~ include/asm-generic/bitops/const_hweight.h:28:89: note: expanded from macro 'hweight32'
28 | #define hweight32(w) (__builtin_constant_p(w) ? __const_hweight32(w) : __arch_hweight32(w))
| ~~~~~~~~~~~~~~~~ ^
4 warnings and 6 errors generated.
vim +119 lib/tests/bitfield_kunit.c
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 94
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 95 #define CHECK(tp, mask) do { \
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 96 u64 v; \
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 97 \
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 98 for (v = 0; v < 1 << hweight32(mask); v++) \
d2585f5164c298 lib/bitfield_kunit.c Vitor Massaru Iha 2020-07-29 99 KUNIT_ASSERT_FALSE(context, \
d2585f5164c298 lib/bitfield_kunit.c Vitor Massaru Iha 2020-07-29 100 tp##_encode_bits(v, mask) != v << __ffs64(mask));\
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 101 } while (0)
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 102
d2585f5164c298 lib/bitfield_kunit.c Vitor Massaru Iha 2020-07-29 103 static void __init test_bitfields_variables(struct kunit *context)
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 104 {
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 105 CHECK(u8, 0x0f);
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 106 CHECK(u8, 0xf0);
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 107 CHECK(u8, 0x38);
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 108
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 109 CHECK(u16, 0x0038);
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 110 CHECK(u16, 0x0380);
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 111 CHECK(u16, 0x3800);
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 112 CHECK(u16, 0x8000);
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 113
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 114 CHECK(u32, 0x80000000);
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 115 CHECK(u32, 0x7f000000);
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 116 CHECK(u32, 0x07e00000);
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 117 CHECK(u32, 0x00018000);
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 118
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 @119 CHECK(u64, 0x8000000000000000ull);
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 120 CHECK(u64, 0x7f00000000000000ull);
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 121 CHECK(u64, 0x0001800000000000ull);
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 122 CHECK(u64, 0x0000000080000000ull);
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 123 CHECK(u64, 0x000000007f000000ull);
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 124 CHECK(u64, 0x0000000018000000ull);
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 125 CHECK(u64, 0x0000001f8000000ull);
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 126 }
0e2dc70e3d0d50 lib/test_bitfield.c Johannes Berg 2018-06-20 127 :::::: The code at line 119 was first introduced by commit :::::: 0e2dc70e3d0d503b0cc9c5f74db3eb6db52c9e22 bitfield: add tests
:::::: TO: Johannes Berg <[email protected]> :::::: CC: Kalle Valo <[email protected]>
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Quoted 11 lines · kernel test robot
Hi Kees,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: be5c7bbb3a64baf884481a1ba0c2f8fb2f93f7c3 commit: 0ef71a1dc3a5355f229e2869e97de94e8e7ec7d0 [2690/5524] Merge branch 'for-next/hardening' into for-next/kspp config: powerpc-randconfig-003-20250228 (https://download.01.org/0day-ci/archive/20250228/[email protected]/config) compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250228/[email protected]/reproduce)
Quoted 4 lines
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
This uncovered a circular header dependency, and should now be fixed with:
https://lore.kernel.org/lkml/[email protected]/
Thanks for the report!
-Kees
Signature · 1 line
Kees Cook