mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 10:45:49 +00:00
bpf: Call kfree(obj) only once in free_one()
A kfree() call is always used at the end of this function implementation. Thus specify such a function call only once instead of duplicating it in a previous if branch. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/bpf/08987123-668c-40f3-a8ee-c3038d94f069@web.de Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
90d0f736bd
commit
40f34d6f12
@ -252,11 +252,8 @@ static void alloc_bulk(struct bpf_mem_cache *c, int cnt, int node, bool atomic)
|
||||
|
||||
static void free_one(void *obj, bool percpu)
|
||||
{
|
||||
if (percpu) {
|
||||
if (percpu)
|
||||
free_percpu(((void __percpu **)obj)[1]);
|
||||
kfree(obj);
|
||||
return;
|
||||
}
|
||||
|
||||
kfree(obj);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user