[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <5e723666.1c69fb81.3545b.79c3@mx.google.com>
Date: Wed, 18 Mar 2020 20:25:22 +0530
From: Rohit Sarkar <rohitsarkar5398@...il.com>
To: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: jic23@...nel.org, rohitsarkar5398@...il.com,
dragos.bogdan@...log.com, Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Stefan Popa <stefan.popa@...log.com>, knaack.h@....de,
pmeerw@...erw.net
Subject: [PATCH] iio: gyro: adis16136: use scnprintf instead of snprintf
scnprintf returns the actual number of bytes written into the buffer as
opposed to snprintf which returns the number of bytes that would have
been written if the buffer was big enough. Using the output of snprintf
may lead to difficult to detect bugs.
Thanks,
Rohit
Signed-off-by: Rohit Sarkar <rohitsarkar5398@...il.com>
---
drivers/iio/gyro/adis16136.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/gyro/adis16136.c b/drivers/iio/gyro/adis16136.c
index a4c967a5fc5c..0a8bb02dc4b9 100644
--- a/drivers/iio/gyro/adis16136.c
+++ b/drivers/iio/gyro/adis16136.c
@@ -96,7 +96,7 @@ static ssize_t adis16136_show_serial(struct file *file,
if (ret)
return ret;
- len = snprintf(buf, sizeof(buf), "%.4x%.4x%.4x-%.4x\n", lot1, lot2,
+ len = scnprintf(buf, sizeof(buf), "%.4x%.4x%.4x-%.4x\n", lot1, lot2,
lot3, serial);
return simple_read_from_buffer(userbuf, count, ppos, buf, len);
--
2.23.0.385.gbc12974a89
Powered by blists - more mailing lists