summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMahad Ibrahim <mahad.ibrahim.dev@gmail.com>2026-08-08 22:38:29 +0000
committerMika Westerberg <mika.westerberg@linux.intel.com>2026-08-10 12:50:16 +0200
commitf7c0e02eb61284395f74424edaefbbd323f83c4e (patch)
tree72f06527ffaf287515c70816763586470ad772b2 /include
parentf1de1fc5f632cdeae1f5c2984572ab710d4dfcaa (diff)
downloadlinux-f7c0e02eb61284395f74424edaefbbd323f83c4e.tar.gz
linux-f7c0e02eb61284395f74424edaefbbd323f83c4e.zip
thunderbolt: debugfs: Replace get_zeroed_page() with kzalloc()
validate_and_copy_from_user() allocates a page to store data from userspace via get_zeroed_page(), and then returns it as a buffer. Neither the function itself nor its callers require struct page access. This buffer can easily be allocated with kzalloc() as there is nothing special about it that requires going through the page allocator. kzalloc(), which internally reduces to kmalloc() with __GFP_ZERO, provides a better API and kfree() does not need to know the size of the freed object. Additionally it removes the casts of (void *) and (unsigned long) which only obfuscate the code. Replace get_zeroed_page() with kzalloc() and free_page() with kfree(). Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com/ Signed-off-by: Mahad Ibrahim <mahad.ibrahim.dev@gmail.com> Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions