BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Breno Leitao" <leitao@debian.org>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next 3/3] selftests: net: getsockopt_iter: cover tcp
Date: Fri, 13 Nov 2026 17:07:50 +0000	[thread overview]
Message-ID: <sashiko-outbox-213276@kernel.org> (raw)
In-Reply-To: <20261112-getsockopt_phase7-v1-3-1eb759dd0929@debian.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests: net: nodelay_undersize_clamped() uses optlen=1 and
  cannot test clamping vs 1-byte shrink
--

commit d0de5c7edf661839608cbe0dcd2d478b9815dc91
Author: Breno Leitao <leitao@debian.org>

selftests: net: getsockopt_iter: cover tcp

This commit adds a kselftest fixture covering do_tcp_getsockopt() across
exact, undersized, and oversized option buffers.

> diff --git a/tools/testing/selftests/net/getsockopt_iter.c b/tools/testing/selftests/net/getsockopt_iter.c
> index 2367fce226d4c..4e51c8aa6a855 100644
> --- a/tools/testing/selftests/net/getsockopt_iter.c
> +++ b/tools/testing/selftests/net/getsockopt_iter.c

[ ... ]

> @@ -1005,4 +1008,246 @@ TEST_F(tls, bad_optname)

[ ... ]

> +/* Unlike IPv4, TCP clamps the reply rather than shrinking it to a byte. */
> +TEST_F(tcp, nodelay_undersize_clamped)
> +{
> +	socklen_t optlen = 1;
> +	int val = 0;
> +
> +	ASSERT_EQ(0, getsockopt(self->fd, IPPROTO_TCP, TCP_NODELAY, &val,
> +				&optlen));
> +	ASSERT_EQ(1, optlen);
> +}

[Severity: Low]
Does passing optlen = 1 in nodelay_undersize_clamped() distinguish clamping to
optlen from shrinking a sub-int reply to a single byte?  Both min_t(unsigned
int, len, sizeof(int)) in do_tcp_getsockopt() and the single-byte fallback in
do_ip_getsockopt() report optlen == 1 when called with a 1-byte buffer, so
passing optlen = 2 or 3 is needed to test the behavior described in the
comment.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261112-getsockopt_phase7-v1-0-1eb759dd0929@debian.org?part=3

  reply	other threads:[~2026-11-13 17:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 17:05 [PATCH net-next 0/3] tcp: convert the SOL_TCP getsockopt path to sockopt_t Breno Leitao
2026-11-12 17:05 ` [PATCH net-next 1/3] net/tcp-ao: convert the getsockopt helpers " Breno Leitao
2026-11-13 20:21   ` Stanislav Fomichev
2026-11-12 17:05 ` [PATCH net-next 2/3] tcp: convert do_tcp_getsockopt() " Breno Leitao
2026-11-13 17:07   ` sashiko-bot
2026-11-13 20:21   ` Stanislav Fomichev
2026-11-12 17:05 ` [PATCH net-next 3/3] selftests: net: getsockopt_iter: cover tcp Breno Leitao
2026-11-13 17:07   ` sashiko-bot [this message]
2026-11-13 20:22   ` Stanislav Fomichev

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=sashiko-outbox-213276@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=leitao@debian.org \
    --cc=sashiko-reviews@lists.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