projects
/
platform
/
upstream
/
erofs-utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
27aeef1
)
erofs-utils: limit pclustersize in z_erofs_fixup_deduped_fragment()
author
Noboru Asai
<asai@sijam.com>
Fri, 2 Jun 2023 05:20:39 +0000
(14:20 +0900)
committer
Gao Xiang
<hsiangkao@linux.alibaba.com>
Fri, 2 Jun 2023 10:05:03 +0000
(18:05 +0800)
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>
lib/compress.c
patch
|
blob
|
history
diff --git
a/lib/compress.c
b/lib/compress.c
index 2e1dfb33d92905ea4aa3583a05b952ab831ef4f0..e9430569e618990efff32980a5a57d20a1f6426f 100644
(file)
--- 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;
}