module/decompress: use kvmalloc() consistently
authorAndrea Righi <andrea.righi@canonical.com>
Thu, 2 Nov 2023 08:19:14 +0000 (09:19 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:59:37 +0000 (11:59 +0100)
commitada57fd312cbbb4a387f6627c91260160bea7f7b
tree5edf781c4fd0472443acd59eab7ad218999f83fc
parent85be1a73fd298ed3fd060dfce97caef5f9928c57
module/decompress: use kvmalloc() consistently

[ Upstream commit 17fc8084aa8f9d5235f252fc3978db657dd77e92 ]

We consistently switched from kmalloc() to vmalloc() in module
decompression to prevent potential memory allocation failures with large
modules, however vmalloc() is not as memory-efficient and fast as
kmalloc().

Since we don't know in general the size of the workspace required by the
decompression algorithm, it is more reasonable to use kvmalloc()
consistently, also considering that we don't have special memory
requirements here.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Tested-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/module/decompress.c