mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: feng.wei8@zte.com.cn, linux-kernel@vger.kernel.org
Cc: masahiroy@kernel.org, linux-kbuild@vger.kernel.org
Subject: Re: [PATCH] kconfig: Replace strncpy() with strscpy()
Date: Mon, 17 Mar 2025 09:50:07 +0100	[thread overview]
Message-ID: <6180248b-7ece-4400-a3ac-eda8b7c3959f@kernel.org> (raw)
In-Reply-To: <20250317152257605EN-VIC5_IyrowJu481BsZ@zte.com.cn>

On 17. 03. 25, 8:22, feng.wei8@zte.com.cn wrote:
> From: FengWei <feng.wei8@zte.com.cn>
> 
> supplemented:
> 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>
> ---
>   scripts/kconfig/confdata.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
> index ac95661a1c9d..e547ce003f00 100644
> --- a/scripts/kconfig/confdata.c
> +++ b/scripts/kconfig/confdata.c
> @@ -970,8 +970,7 @@ static int conf_touch_deps(void)
>   	if (depfile_prefix_len + 1 > sizeof(depfile_path))
>   		return -1;
> 
> -	strncpy(depfile_path, name, depfile_prefix_len);
> -	depfile_path[depfile_prefix_len] = 0;
> +	strscpy(depfile_path, name, depfile_prefix_len);

Are you aware this is userspace?

So: do you even compile-test all this?

-- 
js
suse labs


      reply	other threads:[~2025-03-17  8:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-17  7:22 feng.wei8
2025-03-17  8:50 ` Jiri Slaby [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6180248b-7ece-4400-a3ac-eda8b7c3959f@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=feng.wei8@zte.com.cn \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®