Re: [PATCH 09/11] staging: rtl8723bs: convert strncpy to strscpy
From: Arnd Bergmann
Date: Mon Apr 08 2024 - 14:16:13 EST
On Fri, Mar 29, 2024, at 00:01, Justin Stitt wrote:
>> Change both strncpy() instances to strscpy(), which avoids the warning as well
>> as the possibly missing termination. No additional padding is needed here.
>
> Could you also clean up the strncpy present in
> drivers/staging/rtl8723bs/os_dep/os_intfs.c so all these are cleaned
> up at once?
I originally tried not to mix the general conversion with the
warning fixes, but it looks like it has the same issue in theory.
Not sure why there is no warning for this one, I guess it's because
it copies from a fixed-size source of the same length?
Anyway, it's clearly related here so I've added this for v2.
> Maybe we could use the new 2-argument version of strscpy() introduced
> in Commit e6584c3964f2f ("string: Allow 2-argument strscpy()") for all
> 3 of these too.
>
> It looks like:
> strscpy(dest, src);
>
Done now, after double-checking that the sizes actually match.
Thanks for the review,
Arnd