From aa0c7671fe40d783c504714daf057b3213ae1ecb Mon Sep 17 00:00:00 2001 From: Gao Xiang Date: Tue, 14 Jan 2025 12:00:58 +0800 Subject: [PATCH] erofs: fix potential return value overflow of z_erofs_shrink_scan() BugLink: https://bugs.launchpad.net/bugs/2111953 [ Upstream commit db902986dee453bfb5835cbc8efa67154ab34caf ] z_erofs_shrink_scan() could return small numbers due to the mistyped `freed`. Although I don't think it has any visible impact. Fixes: 3883a79abd02 ("staging: erofs: introduce VLE decompression support") Reviewed-by: Chao Yu Signed-off-by: Gao Xiang Link: https://lore.kernel.org/r/20250114040058.459981-1-hsiangkao@linux.alibaba.com Signed-off-by: Sasha Levin Signed-off-by: Manuel Diewald Signed-off-by: Mehmet Basaran --- fs/erofs/zdata.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index bb0562943894..5dea4bfb66c3 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -977,8 +977,7 @@ unsigned long z_erofs_shrink_scan(struct erofs_sb_info *sbi, unsigned long nr_shrink) { struct z_erofs_pcluster *pcl; - unsigned int freed = 0; - unsigned long index; + unsigned long index, freed = 0; xa_lock(&sbi->managed_pslots); xa_for_each(&sbi->managed_pslots, index, pcl) {