[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ebee3406-d515-4e29-9d7c-f54bdb143080@suse.com>
Date: Mon, 13 Oct 2025 08:59:11 +0200
From: Jan Beulich <jbeulich@...e.com>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: linux-hardening@...r.kernel.org, xen-devel@...ts.xenproject.org,
linux-kernel@...r.kernel.org, Juergen Gross <jgross@...e.com>,
Stefano Stabellini <sstabellini@...nel.org>,
Oleksandr Tyshchenko <oleksandr_tyshchenko@...m.com>,
Jason Andryuk <jason.andryuk@....com>,
"Dr. David Alan Gilbert" <linux@...blig.org>
Subject: Re: [PATCH] drivers/xen/xenbus: Replace deprecated strcpy in
xenbus_transaction_end
On 12.10.2025 21:55, Thorsten Blum wrote:
> --- a/drivers/xen/xenbus/xenbus_xs.c
> +++ b/drivers/xen/xenbus/xenbus_xs.c
> @@ -546,16 +546,13 @@ int xenbus_transaction_start(struct xenbus_transaction *t)
> EXPORT_SYMBOL_GPL(xenbus_transaction_start);
>
> /* End a transaction.
> - * If abandon is true, transaction is discarded instead of committed.
> + * If abort is true, transaction is discarded instead of committed.
> */
> -int xenbus_transaction_end(struct xenbus_transaction t, int abort)
> +int xenbus_transaction_end(struct xenbus_transaction t, bool abort)
> {
> char abortstr[2];
>
> - if (abort)
> - strcpy(abortstr, "F");
> - else
> - strcpy(abortstr, "T");
While at least in principle a compiler might be able to transform this into
code not using any library function at all, ...
> + strscpy(abortstr, abort ? "F" : "T");
... the use of a n on-standard function (without equivalent compiler builtin)
doesn't permit this. IOW why not simply switch to e.g.
char abortstr[2] = { [0] = abort ? 'F' : 'T' };
Jan
Powered by blists - more mailing lists