Skip to content
Commit e39e739a authored by Florian Lehner's avatar Florian Lehner Committed by Martin KaFai Lau
Browse files

bpf: check max_entries before allocating memory



For maps of type BPF_MAP_TYPE_CPUMAP memory is allocated first before
checking the max_entries argument. If then max_entries is greater than
NR_CPUS additional work needs to be done to free allocated memory before
an error is returned.
This changes moves the check on max_entries before the allocation
happens.

Signed-off-by: default avatarFlorian Lehner <dev@der-flo.net>
Link: https://lore.kernel.org/r/20221028183405.59554-1-dev@der-flo.net


Signed-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
parent b6d20799
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment