[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <27c4a0ab-a311-4d80-951a-b7912661c463@kernel.org>
Date: Mon, 17 Mar 2025 09:51:39 +0100
From: Jiri Slaby <jirislaby@...nel.org>
To: feng.wei8@....com.cn, tglx@...utronix.de
Cc: darwi@...utronix.de, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tools/x86/kcpuid: Replace deprecated strncpy() with
strscpy()
On 17. 03. 25, 8:32, 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>
> ---
> tools/arch/x86/kcpuid/kcpuid.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/tools/arch/x86/kcpuid/kcpuid.c b/tools/arch/x86/kcpuid/kcpuid.c
> index 1b25c0a95d3f..23a8fde2e203 100644
> --- a/tools/arch/x86/kcpuid/kcpuid.c
> +++ b/tools/arch/x86/kcpuid/kcpuid.c
> @@ -312,8 +312,7 @@ static int parse_line(char *line)
> if (line[0] == '#' || line[0] == '\n')
> return 0;
>
> - strncpy(buffer, line, 511);
> - buffer[511] = 0;
> + strscpy(buffer, line, 511);
Mind you this is userspace?
--
js
suse labs
Powered by blists - more mailing lists