Skip to content

Commit d4be323

Browse files
tobluxdaniel-thompson
authored andcommitted
kdb: Replace deprecated strcpy() with memcpy() in kdb_strdup()
strcpy() is deprecated; use memcpy() instead. Link: KSPP#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>
1 parent 05c81ed commit d4be323

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

kernel/debug/kdb/kdb_support.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/uaccess.h>
2424
#include <linux/kdb.h>
2525
#include <linux/slab.h>
26+
#include <linux/string.h>
2627
#include <linux/ctype.h>
2728
#include "kdb_private.h"
2829

@@ -246,11 +247,12 @@ void kdb_symbol_print(unsigned long addr, const kdb_symtab_t *symtab_p,
246247
*/
247248
char *kdb_strdup(const char *str, gfp_t type)
248249
{
249-
int n = strlen(str)+1;
250+
size_t n = strlen(str) + 1;
250251
char *s = kmalloc(n, type);
251252
if (!s)
252253
return NULL;
253-
return strcpy(s, str);
254+
memcpy(s, str, n);
255+
return s;
254256
}
255257

256258
/*

0 commit comments

Comments
 (0)