Re: [PATCH] x86/boot/string: Add missing function declarations

From: Joe Perches
Date: Thu Dec 09 2021 - 18:47:56 EST


On Thu, 2021-12-09 at 15:37 -0800, Kees Cook wrote:
> On Fri, Nov 19, 2021 at 09:53:25AM -0800, Kees Cook wrote:
> > Silence "missing function declaration" warnings from string.h when
> > building under W=1.
> >
> > Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
> > ---
>
> Hi, just a quick ping on this little fix.
[]
> > diff --git a/arch/x86/boot/string.h b/arch/x86/boot/string.h
[]
> > @@ -8,8 +8,10 @@
> > #undef memcmp
> >
> > void *memcpy(void *dst, const void *src, size_t len);
> > +void *memmove(void *dst, const void *src, size_t len);
> > void *memset(void *dst, int c, size_t len);
> > int memcmp(const void *s1, const void *s2, size_t len);
> > +int bcmp(const void *s1, const void *s2, size_t len);

Unrelated trivia:

Is bcmp still used anywhere in the kernel?

confdata.c is a user-mode program right?

$ git grep -w bcmp
arch/x86/boot/string.c: * Clang may lower `memcmp == 0` to `bcmp == 0`.
arch/x86/boot/string.c:int bcmp(const void *s1, const void *s2, size_t len)
include/linux/string.h:extern int bcmp(const void *,const void *,__kernel_size_t);
lib/Makefile:# Prevent the compiler from calling builtins like memcmp() or bcmp() from this
lib/string.c: * bcmp - returns 0 if and only if the buffers have identical contents.
lib/string.c: * meaning, and architectures may implement their own more efficient bcmp(). So
lib/string.c:int bcmp(const void *a, const void *b, size_t len)
lib/string.c:EXPORT_SYMBOL(bcmp);
scripts/kconfig/confdata.c: if (bcmp(map1, map2, st1.st_size))