android_kernel_xiaomi_sm8350/drivers/pnp
Bjorn Helgaas ea44c1d60d PNP: fix formatting of dbg_pnp_show_resources() output
Each resource should be printed on its own line, so start snprintf'ing
at the beginning of the buffer every time through the loop.

Also, use scnprintf() rather than snprintf() when building up the
buffer to print.  scnprintf() returns the number of characters actually
written into the buffer (not including the trailing NULL).

snprintf() returns the number of characters that *would be* written,
assuming everything would fit in the buffer.  That's nice if we want to
resize the buffer to make sure everything fits, but in this case, I
just want to keep from overflowing the buffer, and it's OK if the
output is truncated.

Using snprintf() meant that my "len" could grow to be more than the
the buffer size, which makes "sizeof(buf) - len" negative, which causes
this alarming WARN_ON:
    http://marc.info/?l=linux-kernel&m=121736480005656&w=2

More useful snprintf/scnprintf discussion:
    http://lwn.net/Articles/69419/

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Reported-by: Pete Clements <clem@clem.clem-digital.net>
Cc: Rene Herman <rene.herman@keyaccess.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-08-01 12:46:41 -07:00
..
isapnp PNP: convert resource options to single linked list 2008-07-16 23:27:07 +02:00
pnpacpi PNPACPI: add support for HP vendor-specific CCSR descriptors 2008-07-16 23:27:07 +02:00
pnpbios PNP: convert resource options to single linked list 2008-07-16 23:27:07 +02:00
base.h make pnp_add_card_id() static 2008-07-26 12:00:11 -07:00
card.c make pnp_add_card_id() static 2008-07-26 12:00:11 -07:00
core.c PNP: convert resource options to single linked list 2008-07-16 23:27:07 +02:00
driver.c
interface.c PNP: convert resource options to single linked list 2008-07-16 23:27:07 +02:00
Kconfig
Makefile
manager.c PNP: convert resource options to single linked list 2008-07-16 23:27:07 +02:00
quirks.c pnp: have quirk_system_pci_resources() include io resources 2008-07-26 12:00:02 -07:00
resource.c PNP: avoid legacy IDE IRQs 2008-07-16 23:27:07 +02:00
support.c PNP: fix formatting of dbg_pnp_show_resources() output 2008-08-01 12:46:41 -07:00
system.c PNP: replace pnp_resource_table with dynamically allocated resources 2008-07-16 23:27:05 +02:00