Re: [PATCH 11/20] hwmon: Manual replacement of the deprecated strlcpy() with return values

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

 



Le lun. 22 févr. 2021 à 16:46, Guenter Roeck <linux@xxxxxxxxxxxx> a écrit :
On 2/22/21 7:12 AM, Romain Perier wrote:
> The strlcpy() reads the entire source buffer first, it is dangerous if
> the source buffer lenght is unbounded or possibility non NULL-terminated.

length

> It can lead to linear read overflows, crashes, etc...
>
Not here. This description is misleading.

> As recommended in the deprecated interfaces [1], it should be replaced
> by strscpy.
>
> This commit replaces all calls to strlcpy that handle the return values
> by the corresponding strscpy calls with new handling of the return
> values (as it is quite different between the two functions).
>
> [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
>
> Signed-off-by: Romain Perier <romain.perier@xxxxxxxxx>

This patch just adds pain to injury, as the source 'buffers' are all fixed
strings and their length will never exceed the maximum buffer length.
I really don't see the point of using strscpy() in this situation.


Hi,

No, no insult or offense at all here (sorry if you understood like this, it is not my intention ^^), it is just a general description of what the usage of strlcpy might cause (the description is not specific to your code). The initial idea was to globally replace all occurrences of the old by the new functions (the old being deprecated for a reason), however, if some maintainers disagree or don't think that their drivers are affected, no problem we can exclude these from the patches series.

Romain
 

[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux