arch/mips/bcm47xx/prom.c:89:8: error: no matching function for call to 'memcmp'

From: kernel test robot
Date: Wed Aug 03 2022 - 06:12:10 EST


Hi Kees,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: e2b542100719a93f8cdf6d90185410d38a57a4c1
commit: 281d0c962752fb40866dd8d4cade68656f34bd1f fortify: Add Clang support
date: 6 months ago
config: mips-randconfig-r023-20220803 (https://download.01.org/0day-ci/archive/20220803/202208031804.qnRvyXLe-lkp@xxxxxxxxx/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 495519e5f8232d144ed26e9c18dbcbac6a5f25eb)
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
# install mips cross compiling tool for clang build
# apt-get install binutils-mipsel-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=281d0c962752fb40866dd8d4cade68656f34bd1f
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 281d0c962752fb40866dd8d4cade68656f34bd1f
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash arch/mips/bcm47xx/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

>> arch/mips/bcm47xx/prom.c:89:8: error: no matching function for call to 'memcmp'
if (!memcmp(prom_init, prom_init + mem, 32))
^~~~~~
include/linux/string.h:156:12: note: candidate function not viable: no known conversion from 'void (void)' to 'const void *' for 1st argument
extern int memcmp(const void *,const void *,__kernel_size_t);
^
include/linux/fortify-string.h:391:5: note: candidate function not viable: no known conversion from 'void (void)' to 'const void *const' for 1st argument
int memcmp(const void * const POS0 p, const void * const POS0 q, __kernel_size_t size)
^
1 error generated.


vim +/memcmp +89 arch/mips/bcm47xx/prom.c

6ee1d93455384ce Rafał Miłecki 2014-07-17 55
25e5fb97419f73d Aurelien Jarno 2007-09-25 56 static __init void prom_init_mem(void)
1c0c13eb935c95f Aurelien Jarno 2007-09-25 57 {
1c0c13eb935c95f Aurelien Jarno 2007-09-25 58 unsigned long mem;
aec922255135389 Hauke Mehrtens 2010-07-27 59 unsigned long max;
c47cc20ca53e792 Hauke Mehrtens 2012-10-03 60 unsigned long off;
d3dce3d676373b1 Hauke Mehrtens 2012-10-03 61 struct cpuinfo_mips *c = &current_cpu_data;
1c0c13eb935c95f Aurelien Jarno 2007-09-25 62
25e5fb97419f73d Aurelien Jarno 2007-09-25 63 /* Figure out memory size by finding aliases.
25e5fb97419f73d Aurelien Jarno 2007-09-25 64 *
25e5fb97419f73d Aurelien Jarno 2007-09-25 65 * We should theoretically use the mapping from CFE using cfe_enummem().
25e5fb97419f73d Aurelien Jarno 2007-09-25 66 * However as the BCM47XX is mostly used on low-memory systems, we
25e5fb97419f73d Aurelien Jarno 2007-09-25 67 * want to reuse the memory used by CFE (around 4MB). That means cfe_*
25e5fb97419f73d Aurelien Jarno 2007-09-25 68 * functions stop to work at some point during the boot, we should only
25e5fb97419f73d Aurelien Jarno 2007-09-25 69 * call them at the beginning of the boot.
aec922255135389 Hauke Mehrtens 2010-07-27 70 *
aec922255135389 Hauke Mehrtens 2010-07-27 71 * BCM47XX uses 128MB for addressing the ram, if the system contains
aec922255135389 Hauke Mehrtens 2010-07-27 72 * less that that amount of ram it remaps the ram more often into the
aec922255135389 Hauke Mehrtens 2010-07-27 73 * available space.
25e5fb97419f73d Aurelien Jarno 2007-09-25 74 */
96a8123e5f96582 Rafał Miłecki 2014-04-19 75
96a8123e5f96582 Rafał Miłecki 2014-04-19 76 /* Physical address, without mapping to any kernel segment */
96a8123e5f96582 Rafał Miłecki 2014-04-19 77 off = CPHYSADDR((unsigned long)prom_init);
96a8123e5f96582 Rafał Miłecki 2014-04-19 78
96a8123e5f96582 Rafał Miłecki 2014-04-19 79 /* Accessing memory after 128 MiB will cause an exception */
96a8123e5f96582 Rafał Miłecki 2014-04-19 80 max = 128 << 20;
96a8123e5f96582 Rafał Miłecki 2014-04-19 81
96a8123e5f96582 Rafał Miłecki 2014-04-19 82 for (mem = 1 << 20; mem < max; mem += 1 << 20) {
96a8123e5f96582 Rafał Miłecki 2014-04-19 83 /* Loop condition may be not enough, off may be over 1 MiB */
96a8123e5f96582 Rafał Miłecki 2014-04-19 84 if (off + mem >= max) {
96a8123e5f96582 Rafał Miłecki 2014-04-19 85 mem = max;
d548ca6b0784a99 Rafał Miłecki 2014-12-10 86 pr_debug("Assume 128MB RAM\n");
aec922255135389 Hauke Mehrtens 2010-07-27 87 break;
aec922255135389 Hauke Mehrtens 2010-07-27 88 }
c47cc20ca53e792 Hauke Mehrtens 2012-10-03 @89 if (!memcmp(prom_init, prom_init + mem, 32))
1c0c13eb935c95f Aurelien Jarno 2007-09-25 90 break;
1c0c13eb935c95f Aurelien Jarno 2007-09-25 91 }
6ee1d93455384ce Rafał Miłecki 2014-07-17 92 lowmem = mem;
1c0c13eb935c95f Aurelien Jarno 2007-09-25 93
d3dce3d676373b1 Hauke Mehrtens 2012-10-03 94 /* Ignoring the last page when ddr size is 128M. Cached
d3dce3d676373b1 Hauke Mehrtens 2012-10-03 95 * accesses to last page is causing the processor to prefetch
d3dce3d676373b1 Hauke Mehrtens 2012-10-03 96 * using address above 128M stepping out of the ddr address
d3dce3d676373b1 Hauke Mehrtens 2012-10-03 97 * space.
d3dce3d676373b1 Hauke Mehrtens 2012-10-03 98 */
d3dce3d676373b1 Hauke Mehrtens 2012-10-03 99 if (c->cputype == CPU_74K && (mem == (128 << 20)))
d3dce3d676373b1 Hauke Mehrtens 2012-10-03 100 mem -= 0x1000;
e7ae8d174eec0b3 Thomas Bogendoerfer 2020-10-09 101 memblock_add(0, mem);
1c0c13eb935c95f Aurelien Jarno 2007-09-25 102 }
1c0c13eb935c95f Aurelien Jarno 2007-09-25 103

:::::: The code at line 89 was first introduced by commit
:::::: c47cc20ca53e792938556aa29103fa889ce0d858 MIPS: BCM47XX: improve memory size detection

:::::: TO: Hauke Mehrtens <hauke@xxxxxxxxxx>
:::::: CC: John Crispin <blogic@xxxxxxxxxxx>

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