2022-11-13 10:37:41

by KaiLong Wang

[permalink] [raw]
Subject: [PATCH] KVM: s390: fix array_size.cocci warning

Fix following coccicheck warning:

arch/s390/tools/gen_facilities.c:151:37-38: WARNING: Use ARRAY_SIZE

Signed-off-by: KaiLong Wang <[email protected]>
---
arch/s390/tools/gen_facilities.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/s390/tools/gen_facilities.c b/arch/s390/tools/gen_facilities.c
index cb0aff5c0187..f607e5092f8d 100644
--- a/arch/s390/tools/gen_facilities.c
+++ b/arch/s390/tools/gen_facilities.c
@@ -148,7 +148,7 @@ static void print_facility_lists(void)
{
unsigned int i;

- for (i = 0; i < sizeof(facility_defs) / sizeof(facility_defs[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(facility_defs); i++)
print_facility_list(&facility_defs[i]);
}

--
2.25.1


2022-11-13 11:08:34

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] KVM: s390: fix array_size.cocci warning

Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on s390/features]
[also build test ERROR on linus/master v6.1-rc4 next-20221111]
[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/wangkailong-jari-cn/KVM-s390-fix-array_size-cocci-warning/20221113-172457
base: https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git features
patch link: https://lore.kernel.org/r/56879380.12c.1847049393b.Coremail.wangkailong%40jari.cn
patch subject: [PATCH] KVM: s390: fix array_size.cocci warning
config: s390-randconfig-r044-20221113
compiler: s390-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/d0542ab32663c9e6759ed99998250b53300650c1
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review wangkailong-jari-cn/KVM-s390-fix-array_size-cocci-warning/20221113-172457
git checkout d0542ab32663c9e6759ed99998250b53300650c1
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=s390 prepare

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All error/warnings (new ones prefixed by >>):

arch/s390/tools/gen_facilities.c: In function 'print_facility_lists':
>> arch/s390/tools/gen_facilities.c:151:25: warning: implicit declaration of function 'ARRAY_SIZE' [-Wimplicit-function-declaration]
151 | for (i = 0; i < ARRAY_SIZE(facility_defs); i++)
| ^~~~~~~~~~
/usr/bin/ld: /tmp/cc82HgHl.o: in function `main':
>> gen_facilities.c:(.text.startup+0x9a): undefined reference to `ARRAY_SIZE'
collect2: error: ld returned 1 exit status
make[2]: *** [scripts/Makefile.host:111: arch/s390/tools/gen_facilities] Error 1
make[2]: Target 'kapi' not remade because of errors.
make[1]: *** [arch/s390/Makefile:151: archprepare] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:231: __sub-make] Error 2
make: Target 'prepare' not remade because of errors.

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (2.59 kB)
config (108.44 kB)
Download all attachments