linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] PCI: Replace use of snprintf() with scnprintf() in show() functions
@ 2020-08-24 23:39 Krzysztof Wilczyński
  2020-08-24 23:39 ` [PATCH 1/3] PCI: Replace use of snprintf() with scnprintf() in resource_alignment_show() Krzysztof Wilczyński
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Krzysztof Wilczyński @ 2020-08-24 23:39 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci

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(-)

-- 
2.28.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-09-01 19:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-24 23:39 [PATCH 0/3] PCI: Replace use of snprintf() with scnprintf() in show() functions Krzysztof Wilczyński
2020-08-24 23:39 ` [PATCH 1/3] PCI: Replace use of snprintf() with scnprintf() in resource_alignment_show() Krzysztof Wilczyński
2020-08-24 23:39 ` [PATCH 2/3] PCI: sysfs: Replace use of snprintf() with scnprintf() in driver_override_show() Krzysztof Wilczyński
2020-08-24 23:39 ` [PATCH 3/3] PCI/P2PDMA: Replace use of snprintf() with scnprintf() in show() functions Krzysztof Wilczyński
2020-09-01 19:05 ` [PATCH 0/3] PCI: " Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).