]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
nilfs2: replace get_zeroed_page() with kzalloc()
authorMike Rapoport (Microsoft) <rppt@kernel.org>
Sat, 23 May 2026 17:54:16 +0000 (20:54 +0300)
committerChristian Brauner <brauner@kernel.org>
Wed, 27 May 2026 13:12:23 +0000 (15:12 +0200)
nilfs_ioctl_wrap_copy() allocates a temporary buffer with
get_zeroed_page().

kzalloc() 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) <rppt@kernel.org>
Link: https://patch.msgid.link/20260523-b4-fs-v1-4-275e36a83f0e@kernel.org
Reviewed-by: Viacheslav Dubeyko <slava@dubeyko.com>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
fs/nilfs2/ioctl.c

index e0a606643e879292fb524070bf91d2a86be4b906..b73f2c5d10f09d3512924804359990481a0400d2 100644 (file)
@@ -69,7 +69,7 @@ static int nilfs_ioctl_wrap_copy(struct the_nilfs *nilfs,
        if (argv->v_index > ~(__u64)0 - argv->v_nmembs)
                return -EINVAL;
 
-       buf = (void *)get_zeroed_page(GFP_NOFS);
+       buf = kzalloc(PAGE_SIZE, GFP_NOFS);
        if (unlikely(!buf))
                return -ENOMEM;
        maxmembs = PAGE_SIZE / argv->v_size;
@@ -107,7 +107,7 @@ static int nilfs_ioctl_wrap_copy(struct the_nilfs *nilfs,
        }
        argv->v_nmembs = total;
 
-       free_pages((unsigned long)buf, 0);
+       kfree(buf);
        return ret;
 }