From: Thorsten Blum Date: Tue, 19 Aug 2025 09:59:03 +0000 (+0200) Subject: kdb: Replace deprecated strcpy() with memcpy() in kdb_strdup() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d4be3238d9e5f4841e5385cba3d81268c00d9e7d;p=users%2Fhch%2Fmisc.git kdb: Replace deprecated strcpy() with memcpy() in kdb_strdup() strcpy() is deprecated; use memcpy() instead. Link: https://github.com/KSPP/linux/issues/88 Reviewed-by: Douglas Anderson Signed-off-by: Thorsten Blum Signed-off-by: Daniel Thompson (RISCstar) --- diff --git a/kernel/debug/kdb/kdb_support.c b/kernel/debug/kdb/kdb_support.c index 05b137e7dcb9..d36281142fa1 100644 --- a/kernel/debug/kdb/kdb_support.c +++ b/kernel/debug/kdb/kdb_support.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "kdb_private.h" @@ -246,11 +247,12 @@ void kdb_symbol_print(unsigned long addr, const kdb_symtab_t *symtab_p, */ char *kdb_strdup(const char *str, gfp_t type) { - int n = strlen(str)+1; + size_t n = strlen(str) + 1; char *s = kmalloc(n, type); if (!s) return NULL; - return strcpy(s, str); + memcpy(s, str, n); + return s; } /*