Skip to content

Commit 52e607e

Browse files
keesgregkh
authored andcommitted
MIPS: BCM47XX: Cast memcmp() of function to (void *)
[ Upstream commit 0dedcf6 ] Clang is especially sensitive about argument type matching when using __overloaded functions (like memcmp(), etc). Help it see that function pointers are just "void *". Avoids this error: 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); Cc: Hauke Mehrtens <[email protected]> Cc: "Rafał Miłecki" <[email protected]> Cc: Thomas Bogendoerfer <[email protected]> Cc: [email protected] Cc: Nathan Chancellor <[email protected]> Cc: Nick Desaulniers <[email protected]> Cc: [email protected] Reported-by: kernel test robot <[email protected]> Link: https://lore.kernel.org/lkml/[email protected] Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 4f4e3ff commit 52e607e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/mips/bcm47xx/prom.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static __init void prom_init_mem(void)
8585
pr_debug("Assume 128MB RAM\n");
8686
break;
8787
}
88-
if (!memcmp(prom_init, prom_init + mem, 32))
88+
if (!memcmp((void *)prom_init, (void *)prom_init + mem, 32))
8989
break;
9090
}
9191
lowmem = mem;
@@ -162,7 +162,7 @@ void __init bcm47xx_prom_highmem_init(void)
162162

163163
off = EXTVBASE + __pa(off);
164164
for (extmem = 128 << 20; extmem < 512 << 20; extmem <<= 1) {
165-
if (!memcmp(prom_init, (void *)(off + extmem), 16))
165+
if (!memcmp((void *)prom_init, (void *)(off + extmem), 16))
166166
break;
167167
}
168168
extmem -= lowmem;

0 commit comments

Comments
 (0)