Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: lucien.xin@gmail.com
Cc: netdev@vger.kernel.org, quic@lists.linux.dev,
	davem@davemloft.net, kuba@kernel.org, edumazet@kernel.org,
	pabeni@redhat.com, horms@kernel.org, metze@samba.org,
	mbuhl@openbsd.org, tfanelli@redhat.com, hepengtao@xiaomi.com,
	dreibh@simula.no, jamie.bainbridge@gmail.com,
	linux-cifs@vger.kernel.org, pc@manguebit.org,
	linkinjeon@kernel.org, tom@talpey.com,
	kernel-tls-handshake@lists.linux.dev, cel@kernel.org,
	jlayton@kernel.org, steved@redhat.com, hare@suse.de,
	aahringo@redhat.com, dhowells@redhat.com, matttbe@kernel.org,
	mail@johnericson.me, xiyou.wangcong@gmail.com,
	alibuda@linux.alibaba.com, jbaron@akamai.com,
	illiliti@protonmail.com, sd@queasysnail.net,
	marcelo.leitner@gmail.com, daniel@haxx.se,
	andrew.gospodarek@broadcom.com, mef@scarletmail.rutgers.edu,
	paul@jakma.org, kuniyu@google.com
Subject: Re: [PATCH net-next v19 03/15] quic: provide common utilities and data structures
Date: Tue, 24 Nov 2026 01:21:03 +0000	[thread overview]
Message-ID: <179548326380.3135.10486164570925258517@kernel.org> (raw)
In-Reply-To: <8b73dfa59d4aad8195f3ab2e3d673d3576e379cf.1795393691.git.lucien.xin@gmail.com>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] quic_data_from_string() (net/quic/common.c:527-567) handles empty
  tokens and whitespace inconsistently.
- [Low] The comment on quic_data_from_string()
  (net/quic/common.c:521-526) says only that "Elements are stored in…

--

quic: provide common utilities and data structures

This patch adds the common data structures and helpers for the QUIC
stack. These include packet header types, connection IDs, address
handling, and the hash tables used for socket and connection ID lookup.
It also adds the quic_data binary type with helpers for parsing, matching
and memory management, plus encode/decode helpers for transport
parameters and frames.

> diff --git a/net/quic/common.c b/net/quic/common.c
> new file mode 100644
> index 0000000000000..e13848f5a72d9
> --- /dev/null
> +++ b/net/quic/common.c
> @@ -0,0 +1,567 @@

[ ... ]

> +/* Parse a comma-separated string into a 'quic_data' list format.
> + *
> + * Each comma-separated token is turned into a length-prefixed element. The
> + * first byte of each element stores the length. Elements are stored in
> + * 'to->data', and 'to->len' is updated.
> + */
> +int quic_data_from_string(struct quic_data *to, u8 *from, u32 len)
> +{
> +	u32 remlen = to->len;

[Severity: Low]
This isn't a bug, but the comment only says that to->len "is updated".
The code also reads to->len as an input. It is the capacity of the
caller-supplied to->data buffer, and every write is checked against it.

> +	struct quic_data d;
> +	u8 *p = to->data;
> +
> +	to->len = 0;

On an -EOVERFLOW or -EINVAL return, to->len holds the partial count of
completed tokens. That is neither the original capacity nor a valid
result. to->data may also hold a partly written element.

Could the comment say that to->len must be set to the buffer size on
input? Could it also say what to->data and to->len contain on failure?

> +	while (len) {
> +		while (len && *from == ' ') {
> +			from++;
> +			len--;
> +		}
> +		if (!len)
> +			break;
> +		if (!remlen)
> +			return -EOVERFLOW;
> +		d.data = p++;
> +		d.len  = 0;
> +		remlen--;
> +		while (len) {
> +			if (*from == ',') {
> +				from++;
> +				len--;
> +				break;
> +			}
> +			if (!remlen)
> +				return -EOVERFLOW;
> +			if (d.len == U8_MAX)
> +				return -EINVAL;
> +			*p++ = *from++;
> +			len--;
> +			d.len++;
> +			remlen--;
> +		}
> +		if (!d.len)
> +			return -EINVAL;

[Severity: Low]
Does this check catch an empty token at the end of the string? The v19
changelog says "Reject empty tokens in quic_data_from_string()". Inputs
",a" and "a,,b" do return -EINVAL here.

For "a,", the inner loop consumes the final ',' and len drops to 0. The
outer while (len) loop then exits and the function returns 0. The empty
element after the comma is never checked.

For "a, ", the leading-space loop consumes the rest of the input. The
if (!len) break then returns 0 as well.

Spaces are also only stripped on one side. Leading spaces are skipped,
but every byte up to the next ',' is copied by:

	*p++ = *from++;

So "h3 ,h3-29" stores the element "h3 " (length 3), while " h3" becomes
"h3". quic_data_has() and quic_data_match() compare these lists byte for
byte, for example the quic_alpn() list. Could an element with a trailing
space ever match the peer's value?

Should trailing empty tokens also be rejected, and trailing spaces
trimmed the same way as leading ones?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1795393690.git.lucien.xin%40gmail.com

  reply	other threads:[~2026-11-24  1:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23  0:27 [PATCH net-next v19 00/15] net: introduce QUIC infrastructure and core subcomponents Xin Long
2026-11-23  0:27 ` [PATCH net-next v19 01/15] net: define IPPROTO_QUIC and SOL_QUIC constants Xin Long
2026-11-24  1:21   ` netdev-bot+sashiko
2026-11-23  0:27 ` [PATCH net-next v19 02/15] net: build socket infrastructure for QUIC protocol Xin Long
2026-11-23  0:27 ` [PATCH net-next v19 03/15] quic: provide common utilities and data structures Xin Long
2026-11-24  1:21   ` netdev-bot+sashiko [this message]
2026-11-23  0:28 ` [PATCH net-next v19 04/15] quic: provide family ops for address and protocol Xin Long
2026-11-24  1:21   ` netdev-bot+sashiko
2026-11-23  0:28 ` [PATCH net-next v19 05/15] quic: provide quic.h header files for kernel and userspace Xin Long
2026-11-23  0:28 ` [PATCH net-next v19 06/15] quic: add stream management Xin Long
2026-11-24  1:21   ` netdev-bot+sashiko
2026-11-23  0:28 ` [PATCH net-next v19 07/15] quic: add connection id management Xin Long
2026-11-24  1:21   ` netdev-bot+sashiko
2026-11-23  0:28 ` [PATCH net-next v19 08/15] quic: add path management Xin Long
2026-11-24  1:21   ` netdev-bot+sashiko
2026-11-23  0:28 ` [PATCH net-next v19 09/15] quic: add congestion control Xin Long
2026-11-24  1:21   ` netdev-bot+sashiko
2026-11-23  0:28 ` [PATCH net-next v19 10/15] quic: add packet number space Xin Long
2026-11-23  0:28 ` [PATCH net-next v19 11/15] quic: add crypto key derivation and installation Xin Long
2026-11-24  1:21   ` netdev-bot+sashiko
2026-11-23  0:28 ` [PATCH net-next v19 12/15] quic: add crypto packet encryption and decryption Xin Long
2026-11-24  1:21   ` netdev-bot+sashiko
2026-11-23  0:28 ` [PATCH net-next v19 13/15] quic: add timer management Xin Long
2026-11-23  0:28 ` [PATCH net-next v19 14/15] quic: add packet builder base Xin Long
2026-11-23  0:28 ` [PATCH net-next v19 15/15] quic: add packet parser base Xin Long
2026-11-24  1:21   ` netdev-bot+sashiko

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=179548326380.3135.10486164570925258517@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=aahringo@redhat.com \
    --cc=alibuda@linux.alibaba.com \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=cel@kernel.org \
    --cc=daniel@haxx.se \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=dreibh@simula.no \
    --cc=edumazet@kernel.org \
    --cc=hare@suse.de \
    --cc=hepengtao@xiaomi.com \
    --cc=horms@kernel.org \
    --cc=illiliti@protonmail.com \
    --cc=jamie.bainbridge@gmail.com \
    --cc=jbaron@akamai.com \
    --cc=jlayton@kernel.org \
    --cc=kernel-tls-handshake@lists.linux.dev \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=mail@johnericson.me \
    --cc=marcelo.leitner@gmail.com \
    --cc=matttbe@kernel.org \
    --cc=mbuhl@openbsd.org \
    --cc=mef@scarletmail.rutgers.edu \
    --cc=metze@samba.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=paul@jakma.org \
    --cc=pc@manguebit.org \
    --cc=quic@lists.linux.dev \
    --cc=sd@queasysnail.net \
    --cc=steved@redhat.com \
    --cc=tfanelli@redhat.com \
    --cc=tom@talpey.com \
    --cc=xiyou.wangcong@gmail.com \
    /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