]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Fix off-by-one error in bpf_mem_cache_idx()
authorHou Tao <houtao1@huawei.com>
Wed, 18 Jan 2023 08:46:30 +0000 (16:46 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2023 10:28:00 +0000 (11:28 +0100)
commitd43491e5a01aa084236f890407acccf1a06f6ce5
treec34d3822326f2ec02a9f50019c0e06d363a35c9d
parent5493714507ce1b6bb1d90daa6a3e0c7c65b92fbc
bpf: Fix off-by-one error in bpf_mem_cache_idx()

[ Upstream commit 36024d023d139a0c8b552dc3b7f4dc7b4c139e8f ]

According to the definition of sizes[NUM_CACHES], when the size passed
to bpf_mem_cache_size() is 256, it should return 6 instead 7.

Fixes: bfb90de6b522 ("bpf: Introduce any context BPF specific memory allocator.")
Signed-off-by: Hou Tao <houtao1@huawei.com>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/r/20230118084630.3750680-1-houtao@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/bpf/memalloc.c