[RH7,2/2] cbt: endless loop on rollback in blk_cbt_map_copy_once

Submitted by Vasily Averin on May 31, 2020, 5:19 a.m.

Details

Message ID a31cda96-172e-d194-0853-2b247bccb7d6@virtuozzo.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Vasily Averin May 31, 2020, 5:19 a.m.
found by smatch:
block/blk-cbt.c:359 blk_cbt_map_copy_once() warn:
 always true condition '(--i >= 0) => (0-u64max >= 0)'

It leads to endless loop on rollback.

https://jira.sw.ru/browse/PSBM-104530
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 block/blk-cbt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/block/blk-cbt.c b/block/blk-cbt.c
index 9899348..46d04ec 100644
--- a/block/blk-cbt.c
+++ b/block/blk-cbt.c
@@ -303,8 +303,7 @@  int blk_cbt_map_copy_once(struct request_queue *q, __u8 *uuid,
 {
 	struct cbt_info *cbt;
 	struct page **map;
-	unsigned long npages;
-	unsigned long i;
+	long npages, i;
 
 	mutex_lock(&cbt_mutex);
 	cbt = q->cbt;