kernel-fxtec-pro1x/tools/iio
Martin Kelly 5b9ebf5bdf tools: iio: iio_generic_buffer: make num_loops signed
commit b119d3bc328e7a9574861ebe0c2110e2776c2de1 upstream.

Currently, num_loops is unsigned, but it's set by strtoll, which returns a
(signed) long long int. This could lead to overflow, and it also makes the
check "num_loops < 0" always be false, since num_loops is unsigned.
Setting num_loops to -1 to loop forever is almost working because num_loops
is getting set to a very high number, but it's technically still incorrect.

Fix this issue by making num_loops signed. This also fixes an error found
by Smatch.

Signed-off-by: Martin Kelly <mkelly@xevo.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 55dda0abcf ("tools: iio: iio_generic_buffer: allow continuous looping")
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-15 08:10:10 +01:00
..
Build iio: tools: move to tools buildsystem 2017-08-09 14:29:36 +01:00
iio_event_monitor.c iio: Add modifier for DUV light 2018-07-23 19:18:10 +01:00
iio_generic_buffer.c tools: iio: iio_generic_buffer: make num_loops signed 2019-02-15 08:10:10 +01:00
iio_utils.c
iio_utils.h
lsiio.c
Makefile tools: fix cross-compile var clobbering 2018-02-21 15:35:42 -08:00