linux-stable/tools/iio
Matti Vaittinen 48797c0bb8 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:49:16 +09:00
..
Makefile tools: iio: Rename generic_buffer to iio_generic_buffer 2016-05-29 19:56:33 +01:00
iio_event_monitor.c iio: Add channel for UV index 2016-04-03 11:14:01 +01:00
iio_generic_buffer.c tools:iio:iio_generic_buffer: fix trigger-less mode 2016-08-29 18:06:21 +01:00
iio_utils.c tools: iio: iio_utils: fix digit calculation 2022-11-03 23:49:16 +09:00
iio_utils.h iio: tools: generic_buffer: auto-enable channels 2016-04-19 19:58:13 +01:00
lsiio.c tools: iio: lsiio: enumerate processed channels 2016-08-15 18:33:23 +01:00