The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] platform/x86: replace strcpy() with strscpy()
@ 2026-05-06 17:50 Melih Emik
  2026-05-11 16:45 ` Ilpo Järvinen
  2026-05-11 20:44 ` David Laight
  0 siblings, 2 replies; 4+ messages in thread
From: Melih Emik @ 2026-05-06 17:50 UTC (permalink / raw)
  To: platform-driver-x86, linux-kernel

Replace strcpy() with strscpy() in dell_rbu to use the preferred

kernel string API for bounded copies.

The destination buffer size is known at compile time

(sizeof(image_type)), so this conversion is safe.

No functional change intended.

Signed-off-by: Melih Emik <melihemik@noirlang.tr>
---
 drivers/platform/x86/dell/dell_rbu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/dell/dell_rbu.c b/drivers/platform/x86/dell/dell_rbu.c
index 3fa9de9aa47b..85eea8898fac 100644
--- a/drivers/platform/x86/dell/dell_rbu.c
+++ b/drivers/platform/x86/dell/dell_rbu.c
@@ -562,9 +562,9 @@ static ssize_t image_type_write(struct file *filp, struct kobject *kobj,
 		buffer[count] = '\0';
 
 	if (strstr(buffer, "mono"))
-		strcpy(image_type, "mono");
+		strscpy(image_type, "mono", sizeof(image_type));
 	else if (strstr(buffer, "packet"))
-		strcpy(image_type, "packet");
+		strscpy(image_type, "packet", sizeof(image_type));
 	else if (strstr(buffer, "init")) {
 		/*
 		 * If due to the user error the driver gets in a bad
-- 
2.54.0


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

end of thread, other threads:[~2026-05-11 20:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-06 17:50 [PATCH] platform/x86: replace strcpy() with strscpy() Melih Emik
2026-05-11 16:45 ` Ilpo Järvinen
2026-05-11 19:19   ` Melih Emik
2026-05-11 20:44 ` David Laight

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox