diff options
author | Hou Tao <houtao1@huawei.com> | 2022-11-16 15:23:49 +0800 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2022-11-17 15:48:50 -0800 |
commit | 927cbb478adf917e0a142b94baa37f06279cc466 (patch) | |
tree | b77bd9e79b4a72bd72e05e0d60bc9e35d072dc66 /drivers/net/mdio | |
parent | 689eb2f1ba46b4b02195ac2a71c55b96d619ebf8 (diff) |
libbpf: Handle size overflow for ringbuf mmap
The maximum size of ringbuf is 2GB on x86-64 host, so 2 * max_entries
will overflow u32 when mapping producer page and data pages. Only
casting max_entries to size_t is not enough, because for 32-bits
application on 64-bits kernel the size of read-only mmap region
also could overflow size_t.
So fixing it by casting the size of read-only mmap region into a __u64
and checking whether or not there will be overflow during mmap.
Fixes: bf99c936f947 ("libbpf: Add BPF ring buffer support")
Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20221116072351.1168938-3-houtao@huaweicloud.com
Diffstat (limited to 'drivers/net/mdio')
0 files changed, 0 insertions, 0 deletions