Re: [PATCH v2] include/linux/kfifo.h: fix some IDEs Intelligence errors and the previous patch was misnamed

From: kernel test robot
Date: Tue Oct 08 2024 - 06:27:45 EST


Hi Xiaofeng,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.12-rc2 next-20241008]
[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/Xiaofeng-Lian/include-linux-kfifo-h-fix-some-IDEs-Intelligence-errors-and-the-previous-patch-was-misnamed/20241006-015547
base: linus/master
patch link: https://lore.kernel.org/r/20241002172427.412715-1-1198715581lxf%40gmail.com
patch subject: [PATCH v2] include/linux/kfifo.h: fix some IDEs Intelligence errors and the previous patch was misnamed
config: i386-buildonly-randconfig-005-20241008 (https://download.01.org/0day-ci/archive/20241008/202410081818.V12XcEDC-lkp@xxxxxxxxx/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/20241008/202410081818.V12XcEDC-lkp@xxxxxxxxx/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 <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410081818.V12XcEDC-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> drivers/crypto/hisilicon/sec/sec_algs.c:912:2: error: member reference base type 'typeof(struct sec_request_el *)' (aka 'struct sec_request_el *') is not a structure or union
912 | INIT_KFIFO(ctx->queue->softqueue);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:151:46: note: expanded from macro 'INIT_KFIFO'
151 | __kfifo->mask = __is_kfifo_ptr(__tmp) ? 0 : __KFIFO_SIZE(__tmp->buf) - 1;\
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:138:34: note: expanded from macro '__KFIFO_SIZE'
138 | DECLARE_KFIFO_PTR(__tmp_kfifo, get_kfifo_data_type(fifo));\
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:130:49: note: expanded from macro 'get_kfifo_data_type'
130 | #define get_kfifo_data_type(fifo) typeof(*(fifo)->type)
| ^ ~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/kfifo.h:84:28: note: expanded from macro 'STRUCT_KFIFO_PTR'
84 | struct __STRUCT_KFIFO_PTR(type, 0, type)
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
include/linux/kfifo.h:79:24: note: expanded from macro '__STRUCT_KFIFO_PTR'
79 | __STRUCT_KFIFO_COMMON(type, recsize, ptrtype); \
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:61:3: note: expanded from macro '__STRUCT_KFIFO_COMMON'
61 | datatype *type; \
| ^~~~~~~~
>> drivers/crypto/hisilicon/sec/sec_algs.c:912:2: error: member reference base type 'typeof(struct sec_request_el *)' (aka 'struct sec_request_el *') is not a structure or union
912 | INIT_KFIFO(ctx->queue->softqueue);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:151:46: note: expanded from macro 'INIT_KFIFO'
151 | __kfifo->mask = __is_kfifo_ptr(__tmp) ? 0 : __KFIFO_SIZE(__tmp->buf) - 1;\
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:138:34: note: expanded from macro '__KFIFO_SIZE'
138 | DECLARE_KFIFO_PTR(__tmp_kfifo, get_kfifo_data_type(fifo));\
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:130:49: note: expanded from macro 'get_kfifo_data_type'
130 | #define get_kfifo_data_type(fifo) typeof(*(fifo)->type)
| ^ ~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/kfifo.h:84:28: note: expanded from macro 'STRUCT_KFIFO_PTR'
84 | struct __STRUCT_KFIFO_PTR(type, 0, type)
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
include/linux/kfifo.h:79:24: note: expanded from macro '__STRUCT_KFIFO_PTR'
79 | __STRUCT_KFIFO_COMMON(type, recsize, ptrtype); \
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:62:9: note: expanded from macro '__STRUCT_KFIFO_COMMON'
62 | const datatype *const_type; \
| ^~~~~~~~
>> drivers/crypto/hisilicon/sec/sec_algs.c:912:2: error: member reference base type 'typeof(struct sec_request_el *)' (aka 'struct sec_request_el *') is not a structure or union
912 | INIT_KFIFO(ctx->queue->softqueue);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:151:46: note: expanded from macro 'INIT_KFIFO'
151 | __kfifo->mask = __is_kfifo_ptr(__tmp) ? 0 : __KFIFO_SIZE(__tmp->buf) - 1;\
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:138:34: note: expanded from macro '__KFIFO_SIZE'
138 | DECLARE_KFIFO_PTR(__tmp_kfifo, get_kfifo_data_type(fifo));\
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:130:49: note: expanded from macro 'get_kfifo_data_type'
130 | #define get_kfifo_data_type(fifo) typeof(*(fifo)->type)
| ^ ~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/kfifo.h:84:37: note: expanded from macro 'STRUCT_KFIFO_PTR'
84 | struct __STRUCT_KFIFO_PTR(type, 0, type)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
include/linux/kfifo.h:79:39: note: expanded from macro '__STRUCT_KFIFO_PTR'
79 | __STRUCT_KFIFO_COMMON(type, recsize, ptrtype); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
include/linux/kfifo.h:64:3: note: expanded from macro '__STRUCT_KFIFO_COMMON'
64 | ptrtype *ptr; \
| ^~~~~~~
>> drivers/crypto/hisilicon/sec/sec_algs.c:912:2: error: member reference base type 'typeof(struct sec_request_el *)' (aka 'struct sec_request_el *') is not a structure or union
912 | INIT_KFIFO(ctx->queue->softqueue);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:151:46: note: expanded from macro 'INIT_KFIFO'
151 | __kfifo->mask = __is_kfifo_ptr(__tmp) ? 0 : __KFIFO_SIZE(__tmp->buf) - 1;\
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:138:34: note: expanded from macro '__KFIFO_SIZE'
138 | DECLARE_KFIFO_PTR(__tmp_kfifo, get_kfifo_data_type(fifo));\
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:130:49: note: expanded from macro 'get_kfifo_data_type'
130 | #define get_kfifo_data_type(fifo) typeof(*(fifo)->type)
| ^ ~~~~
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/kfifo.h:84:37: note: expanded from macro 'STRUCT_KFIFO_PTR'
84 | struct __STRUCT_KFIFO_PTR(type, 0, type)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
include/linux/kfifo.h:79:39: note: expanded from macro '__STRUCT_KFIFO_PTR'
79 | __STRUCT_KFIFO_COMMON(type, recsize, ptrtype); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
include/linux/kfifo.h:65:3: note: expanded from macro '__STRUCT_KFIFO_COMMON'
65 | ptrtype const *ptr_const; \
| ^~~~~~~
>> drivers/crypto/hisilicon/sec/sec_algs.c:912:2: error: member reference base type 'typeof(struct sec_request_el *)' (aka 'struct sec_request_el *') is not a structure or union
912 | INIT_KFIFO(ctx->queue->softqueue);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:151:46: note: expanded from macro 'INIT_KFIFO'
151 | __kfifo->mask = __is_kfifo_ptr(__tmp) ? 0 : __KFIFO_SIZE(__tmp->buf) - 1;\
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:138:34: note: expanded from macro '__KFIFO_SIZE'
138 | DECLARE_KFIFO_PTR(__tmp_kfifo, get_kfifo_data_type(fifo));\
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:130:49: note: expanded from macro 'get_kfifo_data_type'
130 | #define get_kfifo_data_type(fifo) typeof(*(fifo)->type)
| ^ ~~~~
include/linux/kfifo.h:116:56: note: expanded from macro 'DECLARE_KFIFO_PTR'
116 | #define DECLARE_KFIFO_PTR(fifo, type) STRUCT_KFIFO_PTR(type) fifo
| ~~~~~~~~~~~~~~~~~^~~~~
include/linux/kfifo.h:84:28: note: expanded from macro 'STRUCT_KFIFO_PTR'
84 | struct __STRUCT_KFIFO_PTR(type, 0, type)
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
include/linux/kfifo.h:80:2: note: expanded from macro '__STRUCT_KFIFO_PTR'
80 | type buf[0]; \
| ^~~~
>> drivers/crypto/hisilicon/sec/sec_algs.c:912:2: error: member reference base type 'typeof(struct sec_request_el *)' (aka 'struct sec_request_el *') is not a structure or union
912 | INIT_KFIFO(ctx->queue->softqueue);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:151:46: note: expanded from macro 'INIT_KFIFO'
151 | __kfifo->mask = __is_kfifo_ptr(__tmp) ? 0 : __KFIFO_SIZE(__tmp->buf) - 1;\
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:139:52: note: expanded from macro '__KFIFO_SIZE'
139 | (sizeof(*(fifo)) - sizeof(__tmp_kfifo)) / sizeof(get_kfifo_data_type(fifo));\
| ^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:130:49: note: expanded from macro 'get_kfifo_data_type'
130 | #define get_kfifo_data_type(fifo) typeof(*(fifo)->type)
| ~~~~~~^ ~~~~
>> drivers/crypto/hisilicon/sec/sec_algs.c:912:2: error: invalid operands to binary expression ('void' and 'int')
912 | INIT_KFIFO(ctx->queue->softqueue);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kfifo.h:151:71: note: expanded from macro 'INIT_KFIFO'
151 | __kfifo->mask = __is_kfifo_ptr(__tmp) ? 0 : __KFIFO_SIZE(__tmp->buf) - 1;\
| ~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
7 errors generated.

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for MODVERSIONS
Depends on [n]: MODULES [=y] && !COMPILE_TEST [=y]
Selected by [y]:
- RANDSTRUCT_FULL [=y] && (CC_HAS_RANDSTRUCT [=y] || GCC_PLUGINS [=n]) && MODULES [=y]


vim +912 drivers/crypto/hisilicon/sec/sec_algs.c

915e4e8413dacc Jonathan Cameron 2018-07-23 902
915e4e8413dacc Jonathan Cameron 2018-07-23 903 static int sec_alg_skcipher_init_with_queue(struct crypto_skcipher *tfm)
915e4e8413dacc Jonathan Cameron 2018-07-23 904 {
915e4e8413dacc Jonathan Cameron 2018-07-23 905 struct sec_alg_tfm_ctx *ctx = crypto_skcipher_ctx(tfm);
915e4e8413dacc Jonathan Cameron 2018-07-23 906 int ret;
915e4e8413dacc Jonathan Cameron 2018-07-23 907
915e4e8413dacc Jonathan Cameron 2018-07-23 908 ret = sec_alg_skcipher_init(tfm);
915e4e8413dacc Jonathan Cameron 2018-07-23 909 if (ret)
915e4e8413dacc Jonathan Cameron 2018-07-23 910 return ret;
915e4e8413dacc Jonathan Cameron 2018-07-23 911
915e4e8413dacc Jonathan Cameron 2018-07-23 @912 INIT_KFIFO(ctx->queue->softqueue);
915e4e8413dacc Jonathan Cameron 2018-07-23 913 ret = kfifo_alloc(&ctx->queue->softqueue, 512, GFP_KERNEL);
915e4e8413dacc Jonathan Cameron 2018-07-23 914 if (ret) {
915e4e8413dacc Jonathan Cameron 2018-07-23 915 sec_alg_skcipher_exit(tfm);
915e4e8413dacc Jonathan Cameron 2018-07-23 916 return ret;
915e4e8413dacc Jonathan Cameron 2018-07-23 917 }
915e4e8413dacc Jonathan Cameron 2018-07-23 918 ctx->queue->havesoftqueue = true;
915e4e8413dacc Jonathan Cameron 2018-07-23 919
915e4e8413dacc Jonathan Cameron 2018-07-23 920 return 0;
915e4e8413dacc Jonathan Cameron 2018-07-23 921 }
915e4e8413dacc Jonathan Cameron 2018-07-23 922

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki