mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-04 16:15:11 +00:00
tools: iio: iio_generic_buffer: make num_loops signed
commitb119d3bc32
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>
This commit is contained in:
parent
88ff6a0b99
commit
5b9ebf5bdf
1 changed files with 1 additions and 1 deletions
|
@ -330,7 +330,7 @@ static const struct option longopts[] = {
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
unsigned long long num_loops = 2;
|
||||
long long num_loops = 2;
|
||||
unsigned long timedelay = 1000000;
|
||||
unsigned long buf_len = 128;
|
||||
|
||||
|
|
Loading…
Reference in a new issue