iio:imu: adis16480: show_firmware() buffer too small
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 27 Nov 2012 07:31:00 +0000 (07:31 +0000)
committerJonathan Cameron <jic23@kernel.org>
Fri, 30 Nov 2012 13:10:16 +0000 (13:10 +0000)
commitafc3a57a2efc4af623df07771c6b1aef15158537
tree614b81a5e5c6e18c9b03e4e1fd8e83bf46423daa
parent12660138b491b56d1e70333547912c56741be5e8
iio:imu: adis16480: show_firmware() buffer too small

Smatch complains that snprintf() returns the number of characters,
not counting the NUL terminator, which *would* have been printed if
there were enough space.  In other words the return value could be more
than sizeof(buf).

In this case, we are printing something like "ff.ff\n" which is at most
6 characters and a NUL so that's not an issue.  I changed snprintf() to
scnprintf() to silence the warning.

But since the buffer doesn't include space for the NUL terminator, we
need to make it bigger or the "\n" will be truncated off.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-By: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/imu/adis16480.c