The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] erofs: fix potential return value overflow of z_erofs_shrink_scan()
@ 2025-01-14  4:00 Gao Xiang
  2025-01-16  8:31 ` Chao Yu
  0 siblings, 1 reply; 3+ messages in thread
From: Gao Xiang @ 2025-01-14  4:00 UTC (permalink / raw)
  To: linux-erofs; +Cc: LKML, 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.

Fixes: 3883a79abd02 ("staging: erofs: introduce VLE decompression support")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 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 8bafc4d9edbe..057d68eaa5d2 100644
--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -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) {
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] erofs: fix potential return value overflow of z_erofs_shrink_scan()
  2025-01-14  4:00 [PATCH] erofs: fix potential return value overflow of z_erofs_shrink_scan() Gao Xiang
@ 2025-01-16  8:31 ` Chao Yu
  2025-01-16  8:33   ` Gao Xiang
  0 siblings, 1 reply; 3+ messages in thread
From: Chao Yu @ 2025-01-16  8:31 UTC (permalink / raw)
  To: Gao Xiang, linux-erofs; +Cc: chao, LKML

On 1/14/25 12:00, Gao Xiang wrote:
> 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...

> 
> Fixes: 3883a79abd02 ("staging: erofs: introduce VLE decompression support")
> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] erofs: fix potential return value overflow of z_erofs_shrink_scan()
  2025-01-16  8:31 ` Chao Yu
@ 2025-01-16  8:33   ` Gao Xiang
  0 siblings, 0 replies; 3+ messages in thread
From: Gao Xiang @ 2025-01-16  8:33 UTC (permalink / raw)
  To: Chao Yu, linux-erofs; +Cc: LKML



On 2025/1/16 16:31, Chao Yu wrote:
> On 1/14/25 12:00, Gao Xiang wrote:
>> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-16  8:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-14  4:00 [PATCH] erofs: fix potential return value overflow of z_erofs_shrink_scan() Gao Xiang
2025-01-16  8:31 ` Chao Yu
2025-01-16  8:33   ` Gao Xiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox