* [PATCH bpf] samples/bpf: Fix buffer overflow in tcp_basertt
@ 2023-05-05 8:50 Pengcheng Yang
2023-05-05 15:40 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Pengcheng Yang @ 2023-05-05 8:50 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Song Liu,
Yonghong Song
Cc: Lawrence Brakmo, bpf, Pengcheng Yang
Using sizeof(nv) or strlen(nv)+1 is correct.
Fixes: c890063e4404 ("bpf: sample BPF_SOCKET_OPS_BASE_RTT program")
Signed-off-by: Pengcheng Yang <yangpc@wangsu.com>
---
samples/bpf/tcp_basertt_kern.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/samples/bpf/tcp_basertt_kern.c b/samples/bpf/tcp_basertt_kern.c
index 8dfe09a92fec..822b0742b815 100644
--- a/samples/bpf/tcp_basertt_kern.c
+++ b/samples/bpf/tcp_basertt_kern.c
@@ -47,7 +47,7 @@ int bpf_basertt(struct bpf_sock_ops *skops)
case BPF_SOCK_OPS_BASE_RTT:
n = bpf_getsockopt(skops, SOL_TCP, TCP_CONGESTION,
cong, sizeof(cong));
- if (!n && !__builtin_memcmp(cong, nv, sizeof(nv)+1)) {
+ if (!n && !__builtin_memcmp(cong, nv, sizeof(nv))) {
/* Set base_rtt to 80us */
rv = 80;
} else if (n) {
--
2.38.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH bpf] samples/bpf: Fix buffer overflow in tcp_basertt
2023-05-05 8:50 [PATCH bpf] samples/bpf: Fix buffer overflow in tcp_basertt Pengcheng Yang
@ 2023-05-05 15:40 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-05-05 15:40 UTC (permalink / raw)
To: Pengcheng Yang; +Cc: ast, daniel, andrii, song, yhs, brakmo, bpf
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Fri, 5 May 2023 16:50:58 +0800 you wrote:
> Using sizeof(nv) or strlen(nv)+1 is correct.
>
> Fixes: c890063e4404 ("bpf: sample BPF_SOCKET_OPS_BASE_RTT program")
> Signed-off-by: Pengcheng Yang <yangpc@wangsu.com>
> ---
> samples/bpf/tcp_basertt_kern.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
- [bpf] samples/bpf: Fix buffer overflow in tcp_basertt
https://git.kernel.org/bpf/bpf-next/c/f4dea9689c5f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-05 15:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-05 8:50 [PATCH bpf] samples/bpf: Fix buffer overflow in tcp_basertt Pengcheng Yang
2023-05-05 15:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox