[Devel] [PATCH RHEL9 COMMIT] fs/fuse kio: fix incorrect size calculation
Konstantin Khorenko
khorenko at virtuozzo.com
Mon Aug 4 23:27:26 MSK 2025
The commit is pushed to "branch-rh9-5.14.0-427.77.1.vz9.86.x-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh9-5.14.0-427.77.1.vz9.86.4
------>
commit 6045dfe98ee74f5091828d3e2885615d46aba9f3
Author: Liu Kui <kui.liu at virtuozzo.com>
Date: Mon Aug 4 23:18:27 2025 +0800
fs/fuse kio: fix incorrect size calculation
- Replaced bit-shift calculation with DIV_ROUND_UP macro
- Use the correct type for sizeof()
Fixes: 03f5cf5a326c6 ("fs/fuse kio: Refactor pcs_mr to avoid large contiguous
memory allocation")
Signed-off-by: Liu Kui <kui.liu at virtuozzo.com>
Feature: fuse: kRPC - single RPC for kernel and userspace
---
fs/fuse/kio/pcs/pcs_mr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/kio/pcs/pcs_mr.c b/fs/fuse/kio/pcs/pcs_mr.c
index 8e1dbc1121cec..78601d4b80790 100644
--- a/fs/fuse/kio/pcs/pcs_mr.c
+++ b/fs/fuse/kio/pcs/pcs_mr.c
@@ -40,7 +40,7 @@ struct pcs_umem *pcs_umem_get(u64 start, u64 len)
fp_va = start & PAGE_MASK;
npages = PAGE_ALIGN(start + len - fp_va) >> PAGE_SHIFT;
- nchunks = (npages >> PCS_PAGE_CHUNK_SHIFT) + 1;
+ nchunks = DIV_ROUND_UP(npages, PCS_PAGES_PER_CHUNK);
umem = kzalloc(sizeof(*umem), GFP_KERNEL);
if (!umem)
@@ -54,7 +54,7 @@ struct pcs_umem *pcs_umem_get(u64 start, u64 len)
mmap_read_lock(mm_s);
umem->fp_addr = fp_va;
- umem->page_chunk = kcalloc(nchunks, sizeof(struct pcs_page_chunk *), GFP_KERNEL);
+ umem->page_chunk = kcalloc(nchunks, sizeof(struct pcs_page_chunk), GFP_KERNEL);
if (!umem->page_chunk) {
ret = -ENOMEM;
goto out_err;
More information about the Devel
mailing list