From: Mike Rapoport (Microsoft) Date: Sat, 23 May 2026 17:54:20 +0000 (+0300) Subject: libfs: simple_transaction_get(): replace get_zeroed_page() with kzalloc() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02d7d892d26ebbcbc542b9b914522f713ce1735b;p=thirdparty%2Fkernel%2Flinux.git libfs: simple_transaction_get(): replace get_zeroed_page() with kzalloc() simple_transaction_get() allocates memory with get_zeroed_page(). That memory is used as a file local buffer that is accessed using copy_from_user() and simple_read_from_buffer(). kmalloc() is a better API for such use and it also provides better scalability and more debugging possibilities. Replace use of get_zeroed_page() with kzalloc(). Signed-off-by: Mike Rapoport (Microsoft) Link: https://patch.msgid.link/20260523-b4-fs-v1-8-275e36a83f0e@kernel.org Signed-off-by: Christian Brauner (Amutable) --- diff --git a/fs/libfs.c b/fs/libfs.c index 1bbea5e7bae37..80a330c8296f1 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -1258,7 +1258,7 @@ char *simple_transaction_get(struct file *file, const char __user *buf, size_t s if (size > SIMPLE_TRANSACTION_LIMIT - 1) return ERR_PTR(-EFBIG); - ar = (struct simple_transaction_argresp *)get_zeroed_page(GFP_KERNEL); + ar = kzalloc(PAGE_SIZE, GFP_KERNEL); if (!ar) return ERR_PTR(-ENOMEM); @@ -1267,7 +1267,7 @@ char *simple_transaction_get(struct file *file, const char __user *buf, size_t s /* only one write allowed per open */ if (file->private_data) { spin_unlock(&simple_transaction_lock); - free_page((unsigned long)ar); + kfree(ar); return ERR_PTR(-EBUSY); } @@ -1294,7 +1294,7 @@ EXPORT_SYMBOL(simple_transaction_read); int simple_transaction_release(struct inode *inode, struct file *file) { - free_page((unsigned long)file->private_data); + kfree(file->private_data); return 0; } EXPORT_SYMBOL(simple_transaction_release);