mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ACPICA: Replace deprecated strncpy() with strscpy()
@ 2025-03-17  6:38 feng.wei8
  2025-03-17  8:19 ` Krzysztof Kozlowski
  2025-03-26 15:06 ` Rafael J. Wysocki
  0 siblings, 2 replies; 3+ messages in thread
From: feng.wei8 @ 2025-03-17  6:38 UTC (permalink / raw)
  To: robert.moore
  Cc: rafael.j.wysocki, lenb, linux-acpi, acpica-devel, linux-kernel

From: FengWei <feng.wei8@zte.com.cn>

strncpy() is deprecated for NUL-terminated destination buffers. Use
strscpy() instead and remove the manual NUL-termination.

Signed-off-by: FengWei <feng.wei8@zte.com.cn>
---
 drivers/acpi/acpica/utnonansi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/acpi/acpica/utnonansi.c b/drivers/acpi/acpica/utnonansi.c
index ff0802ace19b..1da9b8246011 100644
--- a/drivers/acpi/acpica/utnonansi.c
+++ b/drivers/acpi/acpica/utnonansi.c
@@ -168,8 +168,7 @@ void acpi_ut_safe_strncpy(char *dest, char *source, acpi_size dest_size)
 {
 	/* Always terminate destination string */

-	strncpy(dest, source, dest_size);
-	dest[dest_size - 1] = 0;
+	strscpy(dest, source, dest_size);
 }

 #endif
-- 
2.25.1

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

end of thread, other threads:[~2025-03-26 15:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-17  6:38 [PATCH] ACPICA: Replace deprecated strncpy() with strscpy() feng.wei8
2025-03-17  8:19 ` Krzysztof Kozlowski
2025-03-26 15:06 ` Rafael J. Wysocki

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

all inboxes | Powered by JetHome®