Re: [PATCH 09/11] staging: rtl8723bs: convert strncpy to strscpy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux