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

Vasily Averin vvs at virtuozzo.com
Sun May 31 08:19:59 MSK 2020


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 at virtuozzo.com>
---
 block/blk-cbt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

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;
-- 
1.8.3.1



More information about the Devel mailing list