From: "Michael S. Tsirkin" <mst@redhat.com>
To: sashiko-reviews@lists.linux.dev
Cc: Cheng Yongkang <teel4res@gmail.com>,
virtualization@lists.linux.dev,
Eugenio Perez <eperezma@redhat.com>
Subject: Re: [PATCH net] net: virtio_net: decode tunnel csum_start as little-endian
Date: Fri, 23 Oct 2026 12:40:12 -0400 [thread overview]
Message-ID: <20261023123931-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <sashiko-outbox-182939@kernel.org>
On Fri, Oct 23, 2026 at 04:09:57PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] net: virtio_net: sparse __virtio16 mismatch in virtio_net_hdr_tnl_to_skb()
> --
>
> commit ba7ce0ae4b2dfb77c6b110ada68faaf66de9237f
> Author: Cheng Yongkang <teel4res@gmail.com>
>
> net: virtio_net: decode tunnel csum_start as little-endian
>
> This commit changes virtio_net_hdr_tnl_to_skb() in include/linux/virtio_net.h
> to always decode hdr->csum_start as little-endian during tunnel header offset
> validation, matching the subsequent call to __virtio_net_hdr_to_skb().
>
> > diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
> > index d6466f96cdd00..ddc6341747e53 100644
> > --- a/include/linux/virtio_net.h
> > +++ b/include/linux/virtio_net.h
> > @@ -324,7 +324,7 @@ virtio_net_hdr_tnl_to_skb(struct sk_buff *skb,
> > inner_l3min = virtio_l3min(inner_isv6);
> > outer_l3min = ETH_HLEN + virtio_l3min(outer_isv6);
> >
> > - inner_th = __virtio16_to_cpu(little_endian, hdr->csum_start);
> > + inner_th = le16_to_cpu(hdr->csum_start);
> > inner_nh = le16_to_cpu(vhdr->inner_nh_offset);
> > outer_th = le16_to_cpu(vhdr->outer_th_offset);
> > if (outer_th < outer_l3min ||
>
> [Severity: Low]
> Does passing hdr->csum_start directly to le16_to_cpu() in
> virtio_net_hdr_tnl_to_skb() trigger sparse endianness warnings when building
> callers such as drivers/net/virtio_net.c and drivers/net/tun.c with C=1?
>
> Unlike vhdr->inner_nh_offset and vhdr->outer_th_offset, which are declared as
> __le16 in struct virtio_net_hdr_v1_hash_tunnel, hdr->csum_start is declared as
> __virtio16 in include/uapi/linux/virtio_net.h:
>
> struct virtio_net_hdr {
> ...
> __virtio16 csum_start; /* Position to start checksumming from */
> __virtio16 csum_offset; /* Offset after that to place checksum */
> };
>
> In include/linux/virtio_byteorder.h, __virtio16_to_cpu() performs the forced
> cast from __virtio16 to __le16 before calling le16_to_cpu():
>
> static inline u16 __virtio16_to_cpu(bool little_endian, __virtio16 val)
> {
> if (little_endian)
> return le16_to_cpu((__force __le16)val);
> else
> return be16_to_cpu((__force __be16)val);
> }
>
> Should this use __virtio16_to_cpu(true, hdr->csum_start) instead, matching the
> __virtio_net_hdr_to_skb(skb, hdr, true, ...) call below and
> __cpu_to_virtio16(true, hdr_len) in __virtio_net_set_tnl_hdrlen()?
Ah no wait, this is not my v6. My v6 is ok.
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/179268538303.70821.1734486381476363942@gmail.com?part=1
prev parent reply other threads:[~2026-10-23 16:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 15:26 [PATCH net] net: virtio_net: decode tunnel csum_start as little-endian Cheng Yongkang
2026-10-22 16:11 ` Michael S. Tsirkin
2026-10-23 16:09 ` sashiko-bot
2026-10-23 16:34 ` Michael S. Tsirkin
2026-10-23 16:40 ` Michael S. Tsirkin [this message]
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=20261023123931-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=eperezma@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=teel4res@gmail.com \
--cc=virtualization@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.