[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210219085826.46622-3-alexandru.ardelean@analog.com>
Date: Fri, 19 Feb 2021 10:58:26 +0200
From: Alexandru Ardelean <alexandru.ardelean@...log.com>
To: <linux-kernel@...r.kernel.org>, <linux-iio@...r.kernel.org>
CC: <lars@...afoo.de>, <Michael.Hennerich@...log.com>,
<jic23@...nel.org>, <nuno.sa@...log.com>,
<dragos.bogdan@...log.com>,
Alexandru Ardelean <alexandru.ardelean@...log.com>,
kernel test robot <lkp@...el.com>
Subject: [PATCH 2/2] iio: buffer-dma: fix type of 'i' in iio_dma_buffer_alloc_blocks()
When unwinding the cleanup of the blocks, the type of 'i' is important to
be signed, so that the 'i >= 0' condition doesn't underflow and infinitely
loop (or just cause an access violation).
Fixes: ab925b044cfb ("iio: buffer-dma: Add mmap support")
Reported-by: kernel test robot <lkp@...el.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@...log.com>
---
drivers/iio/buffer/industrialio-buffer-dma.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/iio/buffer/industrialio-buffer-dma.c b/drivers/iio/buffer/industrialio-buffer-dma.c
index d04479194cb4..83074d060535 100644
--- a/drivers/iio/buffer/industrialio-buffer-dma.c
+++ b/drivers/iio/buffer/industrialio-buffer-dma.c
@@ -707,8 +707,7 @@ int iio_dma_buffer_alloc_blocks(struct iio_buffer *buffer,
struct iio_dma_buffer_queue *queue = iio_buffer_to_queue(buffer);
struct iio_dma_buffer_block **blocks;
unsigned int num_blocks;
- unsigned int i;
- int ret = 0;
+ int i, ret = 0;
mutex_lock(&queue->lock);
--
2.27.0
Powered by blists - more mailing lists