Re: [PATCH v2] kernfs: recheck of->released after acquiring the active reference

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all,dev.linux.lists.driver-core,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <[email protected]>
Hi Fan,

kernel test robot noticed the following build errors:

[auto build test ERROR on driver-core/driver-core-testing]
[also build test ERROR on driver-core/driver-core-next driver-core/driver-core-linus linus/master v7.2 next-20260821]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Fan-Wu/kernfs-recheck-of-released-after-acquiring-the-active-reference/20260821-050720
base:   driver-core/driver-core-testing
patch link:    https://lore.kernel.org/r/20260821050720.14848-1-fanwu01%40zju.edu.cn
patch subject: [PATCH v2] kernfs: recheck of->released after acquiring the active reference
config: nios2-allnoconfig (https://download.01.org/0day-ci/archive/20260823/[email protected]/config)
compiler: nios2-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260823/[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 errors (new ones prefixed by >>):

   In file included from include/asm-generic/div64.h:27,
                    from ./arch/nios2/include/generated/asm/div64.h:1,
                    from include/linux/math.h:6,
                    from include/linux/math64.h:6,
                    from include/linux/time.h:6,
                    from include/linux/stat.h:19,
                    from include/linux/fs_dirent.h:5,
                    from include/linux/fs/super_types.h:5,
                    from include/linux/fs/super.h:5,
                    from include/linux/fs.h:5,
                    from fs/kernfs/file.c:10:
   fs/kernfs/file.c: In function 'kernfs_get_active_of':
>> include/linux/compiler_types.h:663:16: error: 'sizeof' applied to a bit-field
     663 |         (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
         |                ^
   include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
      77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
         |                                             ^
   include/linux/compiler_types.h:690:9: note: in expansion of macro '__compiletime_assert'
     690 |         __compiletime_assert(condition, msg, prefix, suffix)
         |         ^~~~~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:702:9: note: in expansion of macro '_compiletime_assert'
     702 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:36:9: note: in expansion of macro 'compiletime_assert'
      36 |         compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
         |         ^~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:36:28: note: in expansion of macro '__native_word'
      36 |         compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
         |                            ^~~~~~~~~~~~~
   include/asm-generic/rwonce.h:49:9: note: in expansion of macro 'compiletime_assert_rwonce_type'
      49 |         compiletime_assert_rwonce_type(x);                              \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/kernfs/file.c:76:22: note: in expansion of macro 'READ_ONCE'
      76 |         if (unlikely(READ_ONCE(of->released))) {
         |                      ^~~~~~~~~
   include/linux/compiler_types.h:663:45: error: 'sizeof' applied to a bit-field
     663 |         (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
         |                                             ^
   include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
      77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
         |                                             ^
   include/linux/compiler_types.h:690:9: note: in expansion of macro '__compiletime_assert'
     690 |         __compiletime_assert(condition, msg, prefix, suffix)
         |         ^~~~~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:702:9: note: in expansion of macro '_compiletime_assert'
     702 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:36:9: note: in expansion of macro 'compiletime_assert'
      36 |         compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
         |         ^~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:36:28: note: in expansion of macro '__native_word'
      36 |         compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
         |                            ^~~~~~~~~~~~~
   include/asm-generic/rwonce.h:49:9: note: in expansion of macro 'compiletime_assert_rwonce_type'
      49 |         compiletime_assert_rwonce_type(x);                              \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/kernfs/file.c:76:22: note: in expansion of macro 'READ_ONCE'
      76 |         if (unlikely(READ_ONCE(of->released))) {
         |                      ^~~~~~~~~
   include/linux/compiler_types.h:664:16: error: 'sizeof' applied to a bit-field
     664 |          sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
         |                ^
   include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
      77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
         |                                             ^
   include/linux/compiler_types.h:690:9: note: in expansion of macro '__compiletime_assert'
     690 |         __compiletime_assert(condition, msg, prefix, suffix)
         |         ^~~~~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:702:9: note: in expansion of macro '_compiletime_assert'
     702 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:36:9: note: in expansion of macro 'compiletime_assert'
      36 |         compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
         |         ^~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:36:28: note: in expansion of macro '__native_word'
      36 |         compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
         |                            ^~~~~~~~~~~~~
   include/asm-generic/rwonce.h:49:9: note: in expansion of macro 'compiletime_assert_rwonce_type'
      49 |         compiletime_assert_rwonce_type(x);                              \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/kernfs/file.c:76:22: note: in expansion of macro 'READ_ONCE'
      76 |         if (unlikely(READ_ONCE(of->released))) {
         |                      ^~~~~~~~~
   include/linux/compiler_types.h:664:44: error: 'sizeof' applied to a bit-field
     664 |          sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
         |                                            ^
   include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
      77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
         |                                             ^
   include/linux/compiler_types.h:690:9: note: in expansion of macro '__compiletime_assert'
     690 |         __compiletime_assert(condition, msg, prefix, suffix)
         |         ^~~~~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:702:9: note: in expansion of macro '_compiletime_assert'
     702 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:36:9: note: in expansion of macro 'compiletime_assert'
      36 |         compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
         |         ^~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:36:28: note: in expansion of macro '__native_word'
      36 |         compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
         |                            ^~~~~~~~~~~~~
   include/asm-generic/rwonce.h:49:9: note: in expansion of macro 'compiletime_assert_rwonce_type'
      49 |         compiletime_assert_rwonce_type(x);                              \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/kernfs/file.c:76:22: note: in expansion of macro 'READ_ONCE'
      76 |         if (unlikely(READ_ONCE(of->released))) {
         |                      ^~~~~~~~~
>> include/asm-generic/rwonce.h:36:54: error: 'sizeof' applied to a bit-field
      36 |         compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
         |                                                      ^
   include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
      77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
         |                                             ^
   include/linux/compiler_types.h:690:9: note: in expansion of macro '__compiletime_assert'
     690 |         __compiletime_assert(condition, msg, prefix, suffix)
         |         ^~~~~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:702:9: note: in expansion of macro '_compiletime_assert'
     702 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:36:9: note: in expansion of macro 'compiletime_assert'
      36 |         compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
         |         ^~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:49:9: note: in expansion of macro 'compiletime_assert_rwonce_type'
      49 |         compiletime_assert_rwonce_type(x);                              \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/kernfs/file.c:76:22: note: in expansion of macro 'READ_ONCE'
      76 |         if (unlikely(READ_ONCE(of->released))) {
         |                      ^~~~~~~~~
>> include/linux/compiler_types.h:626:17: error: 'typeof' applied to a bit-field
     626 |                 _Generic((x),                                           \
         |                 ^~~~~~~~
   include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
      77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
         |                                             ^
   include/asm-generic/rwonce.h:44:43: note: in expansion of macro '__unqual_scalar_typeof'
      44 | #define __READ_ONCE(x)  (*(const volatile __unqual_scalar_typeof(x) *)&(x))
         |                                           ^~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
      50 |         __READ_ONCE(x);                                                 \
         |         ^~~~~~~~~~~
   fs/kernfs/file.c:76:22: note: in expansion of macro 'READ_ONCE'
      76 |         if (unlikely(READ_ONCE(of->released))) {
         |                      ^~~~~~~~~
>> include/asm-generic/rwonce.h:44:71: error: cannot take address of bit-field 'released'
      44 | #define __READ_ONCE(x)  (*(const volatile __unqual_scalar_typeof(x) *)&(x))
         |                                                                       ^
   include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
      77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
         |                                             ^
   include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
      50 |         __READ_ONCE(x);                                                 \
         |         ^~~~~~~~~~~
   fs/kernfs/file.c:76:22: note: in expansion of macro 'READ_ONCE'
      76 |         if (unlikely(READ_ONCE(of->released))) {
         |                      ^~~~~~~~~


vim +/sizeof +663 include/linux/compiler_types.h

d15155824c5014 Will Deacon      2017-10-24  611  
dee081bf8f824c Will Deacon      2019-12-19  612  /*
dee081bf8f824c Will Deacon      2019-12-19  613   * __unqual_scalar_typeof(x) - Declare an unqualified scalar type, leaving
dee081bf8f824c Will Deacon      2019-12-19  614   *			       non-scalar types unchanged.
1fd76043ecb04b Marco Elver      2020-05-27  615   */
fd69b2f7d5f4e1 Peter Zijlstra   2026-01-16  616  #ifndef USE_TYPEOF_UNQUAL
1fd76043ecb04b Marco Elver      2020-05-27  617  /*
6ec4476ac82512 Linus Torvalds   2020-07-08  618   * Prefer C11 _Generic for better compile-times and simpler code. Note: 'char'
1fd76043ecb04b Marco Elver      2020-05-27  619   * is not type-compatible with 'signed char', and we define a separate case.
1fd76043ecb04b Marco Elver      2020-05-27  620   */
1fd76043ecb04b Marco Elver      2020-05-27  621  #define __scalar_type_to_expr_cases(type)				\
1fd76043ecb04b Marco Elver      2020-05-27  622  		unsigned type:	(unsigned type)0,			\
1fd76043ecb04b Marco Elver      2020-05-27  623  		signed type:	(signed type)0
1fd76043ecb04b Marco Elver      2020-05-27  624  
1fd76043ecb04b Marco Elver      2020-05-27  625  #define __unqual_scalar_typeof(x) typeof(				\
1fd76043ecb04b Marco Elver      2020-05-27 @626  		_Generic((x),						\
1fd76043ecb04b Marco Elver      2020-05-27  627  			 char:	(char)0,				\
1fd76043ecb04b Marco Elver      2020-05-27  628  			 __scalar_type_to_expr_cases(char),		\
1fd76043ecb04b Marco Elver      2020-05-27  629  			 __scalar_type_to_expr_cases(short),		\
1fd76043ecb04b Marco Elver      2020-05-27  630  			 __scalar_type_to_expr_cases(int),		\
1fd76043ecb04b Marco Elver      2020-05-27  631  			 __scalar_type_to_expr_cases(long),		\
1fd76043ecb04b Marco Elver      2020-05-27  632  			 __scalar_type_to_expr_cases(long long),	\
1fd76043ecb04b Marco Elver      2020-05-27  633  			 default: (x)))
fd69b2f7d5f4e1 Peter Zijlstra   2026-01-16  634  #else
fd69b2f7d5f4e1 Peter Zijlstra   2026-01-16  635  #define __unqual_scalar_typeof(x) __typeof_unqual__(x)
fd69b2f7d5f4e1 Peter Zijlstra   2026-01-16  636  #endif
c06cd66387da92 Thomas Gleixner  2026-06-02  637  
c06cd66387da92 Thomas Gleixner  2026-06-02  638  #include <asm/percpu_types.h>
c06cd66387da92 Thomas Gleixner  2026-06-02  639  
fd69b2f7d5f4e1 Peter Zijlstra   2026-01-16  640  #endif /* !__ASSEMBLY__ */
dee081bf8f824c Will Deacon      2019-12-19  641  
38a68b982dd0b1 Peter Zijlstra   2025-11-27  642  /*
38a68b982dd0b1 Peter Zijlstra   2025-11-27  643   * __signed_scalar_typeof(x) - Declare a signed scalar type, leaving
38a68b982dd0b1 Peter Zijlstra   2025-11-27  644   *			       non-scalar types unchanged.
38a68b982dd0b1 Peter Zijlstra   2025-11-27  645   */
38a68b982dd0b1 Peter Zijlstra   2025-11-27  646  
38a68b982dd0b1 Peter Zijlstra   2025-11-27  647  #define __scalar_type_to_signed_cases(type)				\
38a68b982dd0b1 Peter Zijlstra   2025-11-27  648  		unsigned type:	(signed type)0,				\
38a68b982dd0b1 Peter Zijlstra   2025-11-27  649  		signed type:	(signed type)0
38a68b982dd0b1 Peter Zijlstra   2025-11-27  650  
38a68b982dd0b1 Peter Zijlstra   2025-11-27  651  #define __signed_scalar_typeof(x) typeof(				\
38a68b982dd0b1 Peter Zijlstra   2025-11-27  652  		_Generic((x),						\
38a68b982dd0b1 Peter Zijlstra   2025-11-27  653  			 char:	(signed char)0,				\
38a68b982dd0b1 Peter Zijlstra   2025-11-27  654  			 __scalar_type_to_signed_cases(char),		\
38a68b982dd0b1 Peter Zijlstra   2025-11-27  655  			 __scalar_type_to_signed_cases(short),		\
38a68b982dd0b1 Peter Zijlstra   2025-11-27  656  			 __scalar_type_to_signed_cases(int),		\
38a68b982dd0b1 Peter Zijlstra   2025-11-27  657  			 __scalar_type_to_signed_cases(long),		\
38a68b982dd0b1 Peter Zijlstra   2025-11-27  658  			 __scalar_type_to_signed_cases(long long),	\
38a68b982dd0b1 Peter Zijlstra   2025-11-27  659  			 default: (x)))
38a68b982dd0b1 Peter Zijlstra   2025-11-27  660  
d15155824c5014 Will Deacon      2017-10-24  661  /* Is this type a native word size -- useful for atomic operations */
815f0ddb346c19 Nick Desaulniers 2018-08-22  662  #define __native_word(t) \
815f0ddb346c19 Nick Desaulniers 2018-08-22 @663  	(sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
815f0ddb346c19 Nick Desaulniers 2018-08-22  664  	 sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
815f0ddb346c19 Nick Desaulniers 2018-08-22  665  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.