summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Blum <thorsten.blum@linux.dev>2025-08-19 11:59:03 +0200
committerDaniel Thompson (RISCstar) <danielt@kernel.org>2025-09-20 19:56:28 +0100
commitd4be3238d9e5f4841e5385cba3d81268c00d9e7d (patch)
treeadbb25737aa2d18ef83bd5e643fc3d4762a20978
parent05c81eddc44733fee60d4c55508c76017995900e (diff)
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 <dianders@chromium.org> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Daniel Thompson (RISCstar) <danielt@kernel.org>
-rw-r--r--kernel/debug/kdb/kdb_support.c6
1 files changed, 4 insertions, 2 deletions
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 <linux/uaccess.h>
#include <linux/kdb.h>
#include <linux/slab.h>
+#include <linux/string.h>
#include <linux/ctype.h>
#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;
}
/*