All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] kdb: Replace deprecated strcpy() with memcpy() in kdb_strdup()
@ 2025-08-18 18:11 Thorsten Blum
  2025-08-18 18:11 ` [PATCH 2/4] kdb: Replace deprecated strcpy() with memmove() in vkdb_printf() Thorsten Blum
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Thorsten Blum @ 2025-08-18 18:11 UTC (permalink / raw)
  To: Jason Wessel, Daniel Thompson, Douglas Anderson, Zhang Heng,
	Dr. David Alan Gilbert
  Cc: linux-hardening, Thorsten Blum, kgdb-bugreport, linux-kernel

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>
---
 kernel/debug/kdb/kdb_support.c | 6 ++++--
 1 file 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;
 }
 
 /*
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-08-18 20:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-18 18:11 [PATCH 1/4] kdb: Replace deprecated strcpy() with memcpy() in kdb_strdup() Thorsten Blum
2025-08-18 18:11 ` [PATCH 2/4] kdb: Replace deprecated strcpy() with memmove() in vkdb_printf() Thorsten Blum
2025-08-18 18:11 ` [PATCH 3/4] kdb: Replace deprecated strcpy() with memcpy() in parse_grep() Thorsten Blum
2025-08-18 20:35   ` Doug Anderson
2025-08-18 18:11 ` [PATCH 4/4] kdb: Replace deprecated strcpy() with helper function in kdb_defcmd() Thorsten Blum
2025-08-18 20:42   ` Doug Anderson
2025-08-18 20:59     ` Thorsten Blum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.