|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] drivers/xen/xenbus: Replace deprecated strcpy in xenbus_transaction_end
On 13. Oct 2025, at 11:24, Jürgen Groß wrote:
> On 13.10.25 10:22, Jan Beulich wrote:
>> On 13.10.2025 09:36, Jürgen Groß wrote:
>>> I would even go further and drop abortstr[] completely:
>>>
>>> diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c
>>> index 528682bf0c7f..c891af7165f5 100644
>>> --- a/drivers/xen/xenbus/xenbus_xs.c
>>> +++ b/drivers/xen/xenbus/xenbus_xs.c
>>> @@ -550,14 +550,8 @@ EXPORT_SYMBOL_GPL(xenbus_transaction_start);
>>> */
>>> int xenbus_transaction_end(struct xenbus_transaction t, int abort)
>>> {
>>> - char abortstr[2];
>>> -
>>> - if (abort)
>>> - strcpy(abortstr, "F");
>>> - else
>>> - strcpy(abortstr, "T");
>>> -
>>> - return xs_error(xs_single(t, XS_TRANSACTION_END, abortstr, NULL));
>>> + return xs_error(xs_single(t, XS_TRANSACTION_END, abort ? "F" : "T",
>>> + NULL));
>>> }
>>> EXPORT_SYMBOL_GPL(xenbus_transaction_end);
>> Hmm, which xs_single() indeed takes a const char *, it then casts away const-
>> ness before handing to xs_talkv().
>
> Yes, the cast is needed as xs_talkv() can handle reads and writes. No problem
> in
> this case, as the string is only read by xs_talkv() (write type operation).
I'll submit a v2.
Thanks,
Thorsten
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |