diff options
| author | Mike Rapoport (Microsoft) <rppt@kernel.org> | 2026-05-20 11:18:57 +0300 |
|---|---|---|
| committer | John Johansen <john.johansen@canonical.com> | 2026-06-13 20:20:13 -0700 |
| commit | 4e905ed27c788fbb9ea4384e93ea85b303000d57 (patch) | |
| tree | e12270ee17d35dda983df8706e88a07c1ec11f79 /security/apparmor | |
| parent | 3e4ca50ee4d88642afa38815775e1ffa90e8dd0b (diff) | |
apparmor: replace get_zeroed_page() with kzalloc()
multi_transaction_new() allocates memory with get_zeroed_page() and uses
it as struct multi_transaction.
The usage of that structure does not require struct page access and it is
better to allocate multi_transaction objects with kzalloc() that provides
better scalability and more debugging possibilities.
Replace use of get_zeroed_page() with kzalloc().
Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com
Reviewed-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security/apparmor')
| -rw-r--r-- | security/apparmor/apparmorfs.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c index 94b8c7979231..56155d7d5b2f 100644 --- a/security/apparmor/apparmorfs.c +++ b/security/apparmor/apparmorfs.c @@ -9,6 +9,7 @@ */ #include <linux/ctype.h> +#include <linux/slab.h> #include <linux/security.h> #include <linux/vmalloc.h> #include <linux/init.h> @@ -906,7 +907,7 @@ static void multi_transaction_kref(struct kref *kref) struct multi_transaction *t; t = container_of(kref, struct multi_transaction, count); - free_page((unsigned long) t); + kfree(t); } static struct multi_transaction * @@ -949,7 +950,7 @@ static struct multi_transaction *multi_transaction_new(struct file *file, if (size > MULTI_TRANSACTION_LIMIT - 1) return ERR_PTR(-EFBIG); - t = (struct multi_transaction *)get_zeroed_page(GFP_KERNEL); + t = kzalloc(PAGE_SIZE, GFP_KERNEL); if (!t) return ERR_PTR(-ENOMEM); kref_init(&t->count); |
