linux/tools/iio
Matti Vaittinen 569709540e tools: iio: iio_utils: fix digit calculation
commit 72b2aa3819 upstream.

The iio_utils uses a digit calculation in order to know length of the
file name containing a buffer number. The digit calculation does not
work for number 0.

This leads to allocation of one character too small buffer for the
file-name when file name contains value '0'. (Eg. buffer0).

Fix digit calculation by returning one digit to be present for number
'0'.

Fixes: 096f9b862e ("tools:iio:iio_utils: implement digit calculation")
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Link: https://lore.kernel.org/r/Y0f+tKCz+ZAIoroQ@dc75zzyyyyyyyyyyyyycy-3.rev.dnainternet.fi
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-11-03 23:59:11 +09:00
..
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
Build tools: iio: Correctly add make dependency for iio_utils 2019-11-10 17:11:06 +00:00
iio_event_monitor.c iio: event_monitor: Enable events before monitoring 2021-03-25 19:13:52 +00:00
iio_generic_buffer.c tools: iio: convert iio_generic_buffer to use new IIO buffer API 2021-03-11 20:47:07 +00:00
iio_utils.c tools: iio: iio_utils: fix digit calculation 2022-11-03 23:59:11 +09:00
iio_utils.h iio: event_monitor: Enable events before monitoring 2021-03-25 19:13:52 +00:00
lsiio.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
Makefile tools: iio: convert iio_generic_buffer to use new IIO buffer API 2021-03-11 20:47:07 +00:00