diff options
author | Noboru Asai <asai@sijam.com> | 2023-06-02 14:20:39 +0900 |
---|---|---|
committer | Gao Xiang <hsiangkao@linux.alibaba.com> | 2023-06-02 18:05:03 +0800 |
commit | 912f53dee67a2f487638bf8caee6ba66f95602bf (patch) | |
tree | fbae22b9cf6a6e5f9eccaadd4211c6c5ecbb008d | |
parent | 27aeef179bf17d5f1d98f827e93d24839a6d4176 (diff) | |
download | erofs-utils-912f53dee67a2f487638bf8caee6ba66f95602bf.tar.gz |
erofs-utils: limit pclustersize in z_erofs_fixup_deduped_fragment()
The variable 'ctx->pclustersize' could be larger than max pclustersize.
Signed-off-by: Noboru Asai <asai@sijam.com>
Reviewed-by: Yue Hu <huyue2@coolpad.com>
Link: https://lore.kernel.org/r/20230602052039.615632-1-asai@sijam.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
-rw-r--r-- | lib/compress.c | 5 |
1 files 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; } |