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@google.com,
pabeni@redhat.com, horms@kernel.org, metze@samba.org,
mbuhl@openbsd.org, tfanelli@redhat.com, hepengtao@xiaomi.com,
dreibh@simula.no, 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 v18 03/15] quic: provide common utilities and data structures
Date: Tue, 10 Nov 2026 22:29:32 +0000 [thread overview]
Message-ID: <179434977271.994134.13327923655573008427@kernel.org> (raw)
In-Reply-To: <d56def04e676265cb24727723f2f66251977078a.1794241655.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) splits tokens
inconsistently.
- [Low] `struct quic_data.len` means two different things and the
comments do not say so.
--
quic: provide common utilities and data structures
This patch adds the common QUIC data structures and helpers. These cover
packet header types, connection IDs, address handling, and hash tables
for socket and connection ID lookup. It also adds a quic_data binary type
with parsing, matching and memory helpers, plus encoders and decoders for
variable-length integers and transport parameters.
> diff --git a/net/quic/common.c b/net/quic/common.c
> new file mode 100644
> index 0000000000000..8114be4fbb1e6
> --- /dev/null
> +++ b/net/quic/common.c
> @@ -0,0 +1,565 @@
[ ... ]
> +/* 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 should the comments say that to->len is an input
here as well as an output?
Everywhere else in this patch, struct quic_data.len is the number of
valid bytes. That holds for quic_data_dup(), quic_data_append(),
quic_data_free(), quic_data_cmp() and the new ticket/token/alpn members.
Here, though, to->len is read on entry as the capacity of to->data. It is
then overwritten with the produced length.
quic_data_to_string() does the same thing with *plen:
int quic_data_to_string(u8 *to, u32 *plen, struct quic_data *from)
{
u32 remlen = *plen;
...
}
Its comment only says "The resulting string length is written to
'*plen'". On the -EINVAL and -EOVERFLOW returns, *plen is left unchanged.
Neither helper has a caller in this patch. Suppose a later caller passes
an existing quic_data, such as quic_alpn(sk) filled by quic_data_dup().
Its payload length would then be treated as the writable buffer size.
Could the in/out convention be documented here, in quic_data_to_string(),
and on struct quic_data in common.h?
> + struct quic_data d;
> + u8 *p = to->data;
> +
> + to->len = 0;
> + 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--;
> + }
> + *d.data = (u8)(d.len);
> + to->len += d.len + 1;
[Severity: Low]
Are empty tokens and spaces handled consistently by this tokenizer?
The length byte is reserved with d.data = p++ before the code knows
whether the token has any content. The inner loop then breaks on ','
even when d.len is still 0. As a result, ",h3", "h3,,h2" and "h3, ,h2"
each store a zero-length element.
A trailing comma such as "h3," does not produce an element, because the
outer loop exits once len reaches 0.
Only leading spaces are stripped. Spaces before a comma are copied into
the token, so "h3 ,h2" stores "h3 " instead of "h3".
quic_data_has() and quic_data_match() compare elements by exact length
and memcmp():
quic_data(&d, p, length);
if (!quic_data_cmp(&d, d2))
return true;
So "h3 " never matches "h3", and a zero-length element matches any
zero-length probe. quic_data_to_string() also writes the empty fields
back out, for example ",h3".
RFC 7301 does not allow empty protocol names in an ALPN list. This patch
has no caller yet, so once one is added only a user's own socket
configuration would be affected.
Should empty tokens be rejected or skipped, and spaces before a comma be
trimmed?
> + }
> + return 0;
> +}
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1794241654.git.lucien.xin%40gmail.com
next prev parent reply other threads:[~2026-11-10 22:29 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 16:27 [PATCH net-next v18 00/15] net: introduce QUIC infrastructure and core subcomponents Xin Long
2026-11-09 16:27 ` [PATCH net-next v18 01/15] net: define IPPROTO_QUIC and SOL_QUIC constants Xin Long
2026-11-09 16:27 ` [PATCH net-next v18 02/15] net: build socket infrastructure for QUIC protocol Xin Long
2026-11-10 22:29 ` netdev-bot+sashiko
2026-11-09 16:27 ` [PATCH net-next v18 03/15] quic: provide common utilities and data structures Xin Long
2026-11-10 22:29 ` netdev-bot+sashiko [this message]
2026-11-09 16:27 ` [PATCH net-next v18 04/15] quic: provide family ops for address and protocol Xin Long
2026-11-09 16:27 ` [PATCH net-next v18 05/15] quic: provide quic.h header files for kernel and userspace Xin Long
2026-11-09 16:27 ` [PATCH net-next v18 06/15] quic: add stream management Xin Long
2026-11-10 22:29 ` netdev-bot+sashiko
2026-11-09 16:27 ` [PATCH net-next v18 07/15] quic: add connection id management Xin Long
2026-11-10 22:29 ` netdev-bot+sashiko
2026-11-09 16:27 ` [PATCH net-next v18 08/15] quic: add path management Xin Long
2026-11-10 22:29 ` netdev-bot+sashiko
2026-11-09 16:27 ` [PATCH net-next v18 09/15] quic: add congestion control Xin Long
2026-11-10 22:29 ` netdev-bot+sashiko
2026-11-09 16:27 ` [PATCH net-next v18 10/15] quic: add packet number space Xin Long
2026-11-10 22:29 ` netdev-bot+sashiko
2026-11-09 16:27 ` [PATCH net-next v18 11/15] quic: add crypto key derivation and installation Xin Long
2026-11-10 22:29 ` netdev-bot+sashiko
2026-11-09 16:27 ` [PATCH net-next v18 12/15] quic: add crypto packet encryption and decryption Xin Long
2026-11-10 22:29 ` netdev-bot+sashiko
2026-11-09 16:27 ` [PATCH net-next v18 13/15] quic: add timer management Xin Long
2026-11-09 16:27 ` [PATCH net-next v18 14/15] quic: add packet builder base Xin Long
2026-11-09 16:27 ` [PATCH net-next v18 15/15] quic: add packet parser base Xin Long
2026-11-10 22:29 ` netdev-bot+sashiko
2026-11-10 15:41 ` [PATCH net-next v18 00/15] net: introduce QUIC infrastructure and core subcomponents Jakub Kicinski
2026-11-10 16:57 ` Xin Long
2026-11-10 17:20 ` Jakub Kicinski
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=179434977271.994134.13327923655573008427@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@google.com \
--cc=hare@suse.de \
--cc=hepengtao@xiaomi.com \
--cc=horms@kernel.org \
--cc=illiliti@protonmail.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