drivers/acpi/acpica/utnonansi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
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
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
>
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
© 2016 - 2025 Red Hat, Inc.