aboutsummaryrefslogtreecommitdiff
path: root/net/unix/sysctl_net_unix.c
diff options
context:
space:
mode:
authorBjorn Helgaas <[email protected]>2008-07-31 00:07:27 -0700
committerLinus Torvalds <[email protected]>2008-08-01 12:46:41 -0700
commitea44c1d60df3640bd956a67c392865c44fe9bc45 (patch)
treea419febccc84cf70c36704f1a444c2c34bda05d7 /net/unix/sysctl_net_unix.c
parent61a2d07d3fb1ac34d142b9b62d4cd60a0f8c229e (diff)
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 <[email protected]> Reported-by: Pete Clements <[email protected]> Cc: Rene Herman <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'net/unix/sysctl_net_unix.c')
0 files changed, 0 insertions, 0 deletions