Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Geliang Tang <geliang@kernel.org>,
	 Andrii Nakryiko <andrii@kernel.org>,
	 Eduard Zingerman <eddyz87@gmail.com>,
	 Mykola Lysenko <mykolal@fb.com>,
	 Alexei Starovoitov <ast@kernel.org>,
	 Daniel Borkmann <daniel@iogearbox.net>,
	 Martin KaFai Lau <martin.lau@linux.dev>,
	 Song Liu <song@kernel.org>,
	 Yonghong Song <yonghong.song@linux.dev>,
	 John Fastabend <john.fastabend@gmail.com>,
	 KP Singh <kpsingh@kernel.org>,
	 Stanislav Fomichev <sdf@google.com>,
	 Hao Luo <haoluo@google.com>,  Jiri Olsa <jolsa@kernel.org>,
	 Shuah Khan <shuah@kernel.org>,
	 Jakub Sitnicki <jakub@cloudflare.com>
Cc: Geliang Tang <tanggeliang@kylinos.cn>,
	 bpf@vger.kernel.org,  linux-kselftest@vger.kernel.org
Subject: RE: [PATCH bpf-next 7/8] selftests/bpf: Check length of recv in test_sockmap
Date: Mon, 27 May 2024 10:06:34 -0700	[thread overview]
Message-ID: <6654bd9a46bd5_23de20826@john.notmuch> (raw)
In-Reply-To: <5172563f7c7b2a2e953cef02e89fc34664a7b190.1716446893.git.tanggeliang@kylinos.cn>

Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> The value of recv in msg_loop may be negative, like EWOULDBLOCK, so it's
> necessary to check if it is positive before accumulating it to bytes_recvd.
> 
> Fixes: 16962b2404ac ("bpf: sockmap, add selftests")
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
>  tools/testing/selftests/bpf/test_sockmap.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c
> index 3654babfac59..4c7cb206b31d 100644
> --- a/tools/testing/selftests/bpf/test_sockmap.c
> +++ b/tools/testing/selftests/bpf/test_sockmap.c
> @@ -681,7 +681,8 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt,
>  				}
>  			}
>  
> -			s->bytes_recvd += recv;
> +			if (recv > 0)
> +				s->bytes_recvd += recv;
>  
>  			if (opt->check_recved_len && s->bytes_recvd > total_bytes) {
>  				errno = EMSGSIZE;
> -- 
> 2.43.0
> 

Acked-by: John Fastabend <john.fastabend@gmail.com>

  reply	other threads:[~2024-05-27 17:06 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-23  6:49 [PATCH bpf-next 0/8] fixes for test_sockmap Geliang Tang
2024-05-23  6:49 ` [PATCH bpf-next 1/8] selftests/bpf: Fix tx_prog_fd values in test_sockmap Geliang Tang
2024-05-27 17:02   ` John Fastabend
2024-05-23  6:49 ` [PATCH bpf-next 2/8] selftests/bpf: Drop duplicate definition of i " Geliang Tang
2024-05-27 17:03   ` John Fastabend
2024-05-23  6:49 ` [PATCH bpf-next 3/8] selftests/bpf: Use bpf_link attachments " Geliang Tang
2024-05-27 17:12   ` John Fastabend
2024-05-27 19:36     ` Jakub Sitnicki
2024-05-28  4:12       ` Geliang Tang
2024-05-30 23:45         ` John Fastabend
2024-05-31 11:13           ` Jakub Sitnicki
2024-05-31 14:35             ` Geliang Tang
2024-05-23  6:50 ` [PATCH bpf-next 4/8] selftests/bpf: Replace tx_prog_fd with tx_prog " Geliang Tang
2024-05-23  6:50 ` [PATCH bpf-next 5/8] selftests/bpf: Drop prog_fd array " Geliang Tang
2024-05-23  6:50 ` [PATCH bpf-next 6/8] selftests/bpf: Fix size of map_fd " Geliang Tang
2024-05-27 17:06   ` John Fastabend
2024-05-23  6:50 ` [PATCH bpf-next 7/8] selftests/bpf: Check length of recv " Geliang Tang
2024-05-27 17:06   ` John Fastabend [this message]
2024-05-23  6:50 ` [PATCH bpf-next 8/8] selftests/bpf: Drop duplicate bpf_map_lookup_elem " Geliang Tang
2024-05-27 17:06   ` John Fastabend
2024-05-31 11:06 ` [PATCH bpf-next 0/8] fixes for test_sockmap Jakub Sitnicki
2024-06-03 17:40 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6654bd9a46bd5_23de20826@john.notmuch \
    --to=john.fastabend@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=geliang@kernel.org \
    --cc=haoluo@google.com \
    --cc=jakub@cloudflare.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mykolal@fb.com \
    --cc=sdf@google.com \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=tanggeliang@kylinos.cn \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox