* [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* Re: [PATCH] ACPICA: Replace deprecated strncpy() with strscpy()
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
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2025-03-17 8:19 UTC (permalink / raw)
To: feng.wei8, robert.moore
Cc: rafael.j.wysocki, lenb, linux-acpi, acpica-devel, linux-kernel
On 17/03/2025 07:38, feng.wei8@zte.com.cn wrote:
> 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);
What is the point of this function now?
Can ZTE slow down and address the feedback first?
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ACPICA: Replace deprecated strncpy() with strscpy()
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
1 sibling, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2025-03-26 15:06 UTC (permalink / raw)
To: feng.wei8
Cc: robert.moore, rafael.j.wysocki, lenb, linux-acpi, acpica-devel,
linux-kernel
On Mon, Mar 17, 2025 at 7:38 AM <feng.wei8@zte.com.cn> wrote:
>
> 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>
In order to modify ACPICA code in the Linux kernel, please first
submit the change in question to the upstream ACPICA project on GitHub
as a pull request. Once that pull request has been merged, you can
send a corresponding Linux patch with a Link: tag pointing to it, but
in principle it is not necessary to do so because ACPICA changes are
automatically integrated into the Linux code base on a more-or-less
regular basis.
Thanks!
> ---
> 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®