Skip to contentSkip to conversation

x86/boot/string: Add missing function declarations

PATCH Applied Kees Cook 3 participants 4 messages Nov 19, 2021 – Dec 10, 2021 x86

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 x86/boot/string: Add missing function declarations

Silence "missing function declaration" warnings from string.h when building under W=1.

---
 arch/x86/boot/string.h | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/boot/string.h +3 -0
index a232da487cd2..e5d2c6b8c2f1 100644
@@ -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);
 
 /* Access builtin version by default. */
 #define memcpy(d,s,l) __builtin_memcpy(d,s,l)
@@ -25,6 +27,7 @@ extern size_t strnlen(const char *s, size_t maxlen);
 extern unsigned int atou(const char *s);
 extern unsigned long long simple_strtoull(const char *cp, char **endp,
 					  unsigned int base);
+long simple_strtol(const char *cp, char **endp, unsigned int base);
 
 int kstrtoull(const char *s, unsigned int base, unsigned long long *res);
 int boot_kstrtoul(const char *s, unsigned int base, unsigned long *res);
Signature · 1 line
2.30.2
author
#1 lore raw
Quoted 5 lines · Kees Cook

Silence "missing function declaration" warnings from string.h when building under W=1.

---

Hi, just a quick ping on this little fix.

Thanks!

-Kees

Quoted 29 lines
 arch/x86/boot/string.h | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/boot/string.h +3 -0
index a232da487cd2..e5d2c6b8c2f1 100644
@@ -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);
 
 /* Access builtin version by default. */
 #define memcpy(d,s,l) __builtin_memcpy(d,s,l)
@@ -25,6 +27,7 @@ extern size_t strnlen(const char *s, size_t maxlen);
 extern unsigned int atou(const char *s);
 extern unsigned long long simple_strtoull(const char *cp, char **endp,
 					  unsigned int base);
+long simple_strtol(const char *cp, char **endp, unsigned int base);
 
 int kstrtoull(const char *s, unsigned int base, unsigned long long *res);
 int boot_kstrtoul(const char *s, unsigned int base, unsigned long *res);
Signature · 1 line
2.30.2
Signature · 1 line
Kees Cook
#2 lore raw
Quoted 8 lines · Kees Cook
Quoted 5 lines · Kees Cook

Silence "missing function declaration" warnings from string.h when building under W=1.

---

Hi, just a quick ping on this little fix.

[]

Quoted 1 line

arch/x86/boot/string.h

Quoted 1 line
arch/x86/boot/string.h +0 -0

[]

Quoted 8 lines

arch/x86/boot/string.h line 14

Quoted 8 lines
arch/x86/boot/string.h +2 -0
@@ -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))
merge bot Applied
#3 lore raw

[tip: x86/cleanups] x86/boot/string: Add missing function prototypes

In reply to Kees Cook
The following commit has been merged into the x86/cleanups branch of tip:

The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID:     bc7aaf52f963674690510e6c1f3710cd0394b25e
Gitweb:        https://git.kernel.org/tip/bc7aaf52f963674690510e6c1f3710cd0394b25e
Author:        Kees Cook <[email protected]>
AuthorDate:    Fri, 19 Nov 2021 09:53:25 -08:00
Committer:     Borislav Petkov <[email protected]>
CommitterDate: Fri, 10 Dec 2021 19:49:06 +01:00

x86/boot/string: Add missing function prototypes

Silence "warning: no previous prototype for ... [-Wmissing-prototypes]" warnings from string.h when building under W=1.

[ bp: Clarify commit message. ]

---
 arch/x86/boot/string.h | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/boot/string.h +3 -0
index a232da4..e5d2c6b 100644
@@ -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);
 
 /* Access builtin version by default. */
 #define memcpy(d,s,l) __builtin_memcpy(d,s,l)
@@ -25,6 +27,7 @@ extern size_t strnlen(const char *s, size_t maxlen);
 extern unsigned int atou(const char *s);
 extern unsigned long long simple_strtoull(const char *cp, char **endp,
 					  unsigned int base);
+long simple_strtol(const char *cp, char **endp, unsigned int base);
 
 int kstrtoull(const char *s, unsigned int base, unsigned long long *res);
 int boot_kstrtoul(const char *s, unsigned int base, unsigned long *res);