Skip to content
Commit 00f0e08f authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Martin KaFai Lau
Browse files

libbpf: fix potential overflow in ring__consume_n()



ringbuf_process_ring() return int64_t, while ring__consume_n() assigns
it to int. It's highly unlikely, but possible for ringbuf_process_ring()
to return value larger than INT_MAX, so use int64_t. ring__consume_n()
does check INT_MAX before returning int result to the user.

Fixes: 4d22ea94 ("libbpf: Add ring__consume_n / ring_buffer__consume_n")
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Acked-by: default avatarKumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20240430201952.888293-1-andrii@kernel.org


Signed-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
parent 29f38ca3
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