[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <hqvjfoaw5ooucqp3mwswrjxletq6vdzztwvlaxvxf5a6bivdzf@7fcytrsqhz4y>
Date: Mon, 18 Aug 2025 11:26:57 -0700
From: Justin Stitt <justinstitt@...gle.com>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: Marco Elver <elver@...gle.com>, Dmitry Vyukov <dvyukov@...gle.com>,
linux-hardening@...r.kernel.org, kasan-dev@...glegroups.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kcsan: test: Replace deprecated strcpy() with strscpy()
Hi,
On Fri, Aug 15, 2025 at 11:37:44PM +0200, Thorsten Blum wrote:
> strcpy() is deprecated; use strscpy() instead.
>
> Link: https://github.com/KSPP/linux/issues/88
> Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
> ---
> kernel/kcsan/kcsan_test.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/kcsan/kcsan_test.c b/kernel/kcsan/kcsan_test.c
> index 49ab81faaed9..ea1cb4c8a894 100644
> --- a/kernel/kcsan/kcsan_test.c
> +++ b/kernel/kcsan/kcsan_test.c
> @@ -125,7 +125,7 @@ static void probe_console(void *ignore, const char *buf, size_t len)
> goto out;
>
> /* No second line of interest. */
> - strcpy(observed.lines[nlines++], "<none>");
> + strscpy(observed.lines[nlines++], "<none>");
Looks good.
Here's my checklist:
1) strcpy() and strscpy() have differing return values, but we aren't using
it.
2) strscpy() can fail with -E2BIG if source is too big, but it isn't in
this case.
3) two-arg version of strscpy() is OK to use here as the source has a known
size at compile time.
Reviewed-by: Justin Stitt <justinstitt@...gle.com>
> }
> }
>
> @@ -231,7 +231,7 @@ static bool __report_matches(const struct expect_report *r)
>
> if (!r->access[1].fn) {
> /* Dummy string if no second access is available. */
> - strcpy(cur, "<none>");
> + strscpy(expect[2], "<none>");
> break;
> }
> }
> --
> 2.50.1
>
>
Thanks
Justin
Powered by blists - more mailing lists