[外部邮件] 此邮件来源于小米公司外部,请谨慎处理。若对邮件安全性存疑,请将邮件转发给misec@xiaomi.com进行反馈
Hi Yue,
On 2023/6/2 13:20, Noboru Asai wrote:
> The variable 'ctx->pclustersize' could be larger than max pclustersize.
>
> Signed-off-by: Noboru Asai <asai@sijam.com>
Please take a look at this patch.
+Cc Shijie Sun.
Thanks,
Gao Xiang
> ---
> lib/compress.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/lib/compress.c b/lib/compress.c
> index 2e1dfb3..e943056 100644
> --- a/lib/compress.c
> +++ b/lib/compress.c
> @@ -359,8 +359,9 @@ static bool z_erofs_fixup_deduped_fragment(struct z_erofs_vle_compress_ctx *ctx,
>
> /* try to fix again if it gets larger (should be rare) */
> if (inode->fragment_size < newsize) {
> - ctx->pclustersize = roundup(newsize - inode->fragment_size,
> - erofs_blksiz());
> + ctx->pclustersize = min(z_erofs_get_max_pclusterblks(inode) * erofs_blksiz(),
> + roundup(newsize - inode->fragment_size,
> + erofs_blksiz()));
> return false;
> }
>