Skip to contentSkip to conversation

erofs: fix potential return value overflow of z_erofs_shrink_scan()

PATCH In review Gao Xiang 2 participants 3 messages Jan 14, 2025 – Jan 16, 2025 EROFS file system

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs: fix potential return value overflow of z_erofs_shrink_scan()

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")
---
 fs/erofs/zdata.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/erofs/zdata.c +1 -2
index 8bafc4d9edbe..057d68eaa5d2 100644
@@ -915,8 +915,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) {
Signature · 1 line
2.43.5
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Gao Xiang

z_erofs_shrink_scan() could return small numbers due to the mistyped freed.

Although I don't think it has any visible impact.

Agreed, it's an extreme case...

Quoted 3 lines
Fixes 3883a79abd02 ("staging: erofs: introduce VLE decompression support")

Thanks,

author
#2 lore raw
Quoted 7 lines · Chao Yu
Quoted 4 lines · Gao Xiang

z_erofs_shrink_scan() could return small numbers due to the mistyped freed.

Although I don't think it has any visible impact.

Agreed, it's an extreme case...

Yeah... also thanks for the review.

Thanks,
Gao Xiang