]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests/bpf: Fix total_bytes in msg_loop_rx in test_sockmap
authorZijian Zhang <zijianzhang@bytedance.com>
Wed, 6 Nov 2024 22:25:15 +0000 (22:25 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 12:53:22 +0000 (13:53 +0100)
commit8527869190fd6d0efe07e5f78985e992c575a281
tree8ab235867e92a1110894e904297b0d3010cce375
parentf7d1f6f7dcd19827729b2a15f09b2e7d1bc5f5bd
selftests/bpf: Fix total_bytes in msg_loop_rx in test_sockmap

[ Upstream commit 523dffccbadea0cfd65f1ff04944b864c558c4a8 ]

total_bytes in msg_loop_rx should also take push into account, otherwise
total_bytes will be a smaller value, which makes the msg_loop_rx end early.

Besides, total_bytes has already taken pop into account, so we don't need
to subtract some bytes from iov_buf in sendmsg_test. The additional
subtraction may make total_bytes a negative number, and msg_loop_rx will
just end without checking anything.

Fixes: 18d4e900a450 ("bpf: Selftests, improve test_sockmap total bytes counter")
Fixes: d69672147faa ("selftests, bpf: Add one test for sockmap with strparser")
Signed-off-by: Zijian Zhang <zijianzhang@bytedance.com>
Reviewed-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/r/20241106222520.527076-4-zijianzhang@bytedance.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/bpf/test_sockmap.c