diff options
author | Dan Carpenter <error27@gmail.com> | 2010-07-25 17:23:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-27 00:05:03 -0400 |
commit | 7b7b0b90592a023ac8946b29cca871bf17741fab (patch) | |
tree | 72637e6bd28dcff682a0b02a0112102523ff4b22 /drivers/net/caif | |
parent | 652c6717465dbd0091dbe04ed9be2f7e59c03c7d (diff) |
caif: handle snprintf() return
snprintf() returns the number of bytes that would have been written. It
can be larger than the size of the buffer. The current code won't
overflow, but people cut and paste this stuff so lets do it right and
also make the static checkers happy.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/caif')
-rw-r--r-- | drivers/net/caif/caif_spi.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/caif/caif_spi.c b/drivers/net/caif/caif_spi.c index 6c948037fc78..f5058ff2b210 100644 --- a/drivers/net/caif/caif_spi.c +++ b/drivers/net/caif/caif_spi.c | |||
@@ -165,6 +165,9 @@ static ssize_t dbgfs_state(struct file *file, char __user *user_buf, | |||
165 | len += snprintf((buf + len), (DEBUGFS_BUF_SIZE - len), | 165 | len += snprintf((buf + len), (DEBUGFS_BUF_SIZE - len), |
166 | "Next RX len: %d\n", cfspi->rx_npck_len); | 166 | "Next RX len: %d\n", cfspi->rx_npck_len); |
167 | 167 | ||
168 | if (len > DEBUGFS_BUF_SIZE) | ||
169 | len = DEBUGFS_BUF_SIZE; | ||
170 | |||
168 | size = simple_read_from_buffer(user_buf, count, ppos, buf, len); | 171 | size = simple_read_from_buffer(user_buf, count, ppos, buf, len); |
169 | kfree(buf); | 172 | kfree(buf); |
170 | 173 | ||