Re: [PATCH 0/3] PCI: Replace use of snprintf() with scnprintf() in show() functions

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

 



On Mon, Aug 24, 2020 at 11:39:15PM +0000, Krzysztof Wilczyński wrote:
> Replace use of snprintf() with scnprintf() in order to adhere to the
> rules in Documentation/filesystems/sysfs.txt, as per:
> 
>   show() must not use snprintf() when formatting the value to be
>   returned to user space. If you can guarantee that an overflow
>   will never happen you can use sprintf() otherwise you must use
>   scnprintf().
> 
> Also resolve the following Coccinelle warnings, for example:
> 
>   drivers/pci/p2pdma.c:69:8-16: WARNING: use scnprintf or sprintf
>   drivers/pci/p2pdma.c:78:8-16: WARNING: use scnprintf or sprintf
>   drivers/pci/p2pdma.c:56:8-16: WARNING: use scnprintf or sprintf
> 
> The Coccinelle warning was added in commit abfc19ff202d ("coccinelle:
> api: add device_attr_show script").
> 
> There is no change to the functionality.
> 
> Related:
>   https://patchwork.kernel.org/patch/9946759/#20969333
>   https://lwn.net/Articles/69419
> 
> Krzysztof Wilczyński (3):
>   PCI: Replace use of snprintf() with scnprintf() in
>     resource_alignment_show()
>   PCI: sysfs: Replace use of snprintf() with scnprintf() in
>     driver_override_show()
>   PCI/P2PDMA: Replace use of snprintf() with scnprintf() in show()
>     functions
> 
>  drivers/pci/p2pdma.c    | 8 ++++----
>  drivers/pci/pci-sysfs.c | 2 +-
>  drivers/pci/pci.c       | 2 +-
>  3 files changed, 6 insertions(+), 6 deletions(-)

Squashed together and applied to pci/misc for v5.10, thanks!



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux