[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0gLweZL_v68aEFOvYYs2zHwT2HzGjf0b7ZD-qmTw6cd=A@mail.gmail.com>
Date: Wed, 26 Mar 2025 16:06:25 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: feng.wei8@....com.cn
Cc: robert.moore@...el.com, rafael.j.wysocki@...el.com, lenb@...nel.org,
linux-acpi@...r.kernel.org, acpica-devel@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ACPICA: Replace deprecated strncpy() with strscpy()
On Mon, Mar 17, 2025 at 7:38 AM <feng.wei8@....com.cn> wrote:
>
> From: FengWei <feng.wei8@....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@....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
>
Powered by blists - more mailing lists