From: sashiko-bot@kernel.org
To: Quchaosheng <quchaosheng000406@163.com>
Cc: "Vincent Mailhol" <mailhol@kernel.org>,
"Oleksij Rempel" <o.rempel@pengutronix.de>,
"Marc Kleine-Budde" <mkl@pengutronix.de>,
"Oliver Hartkopp" <socketcan@hartkopp.net>,
linux-can@vger.kernel.org
Subject: Re: [PATCH] selftests: can: add CAN XL raw socket tests
Date: Wed, 23 Sep 2026 03:02:46 +0000 [thread overview]
Message-ID: <20260923030246.CFE791F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260923025317.374997-1-quchaosheng000406@163.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] kselftests/can: missing XL capability check causes test failure
--
commit 0db65e488a9ffaf096720dc302fd90d7dbdccbc6
Author: Quchaosheng <quchaosheng000406@163.com>
selftests: can: add CAN XL raw socket tests
This commit adds a set of CAN XL tests to `test_raw_filter.c` utilizing a
vcan interface. It tests payload round-trips, frame validation, CAN FD
dependencies, and VCID filtering.
> diff --git a/tools/testing/selftests/net/can/test_raw_filter.c b/tools/testing/selftests/net/can/test_raw_filter.c
> index bb8ae88542737..53f0c9d829ed0 100644
> --- a/tools/testing/selftests/net/can/test_raw_filter.c
> +++ b/tools/testing/selftests/net/can/test_raw_filter.c
[ ... ]
> +static int open_xl_socket(int send_xl, const struct can_raw_vcid_options *vcid)
> +{
> + struct sockaddr_can addr;
> + struct ifreq ifr;
> + int one = 1;
> + int s, ret;
[ ... ]
> + addr.can_family = AF_CAN;
> + addr.can_ifindex = ifr.ifr_ifindex;
> +
> + ret = bind(s, (struct sockaddr *)&addr, sizeof(addr));
[Severity: Low]
This is a pre-existing issue, but does passing this struct to bind() leak
uninitialized stack memory to the kernel?
The addr struct has padding and a large union (can_addr) that are not fully
initialized by setting just can_family and can_ifindex. Could this trigger
memory sanitizer warnings when sizeof(addr) bytes are copied across the
user/kernel boundary?
[ ... ]
> +/* Without VCID options the VCID is stripped on TX and a VCID-tagged frame is
> + * not forwarded on RX
> + */
> +TEST(canxl_vcid_stripped_by_default)
> +{
> + struct can_raw_vcid_options pass = {
> + .flags = CAN_RAW_XL_VCID_TX_PASS,
> + };
> + struct canxl_frame tx, rx;
> + int tx_sock, rx_sock, ret;
> +
> + tx_sock = open_xl_socket(1, &pass);
> + ASSERT_GE(tx_sock, 0)
> + TH_LOG("CAN XL not supported on %s", CANIF);
> +
> + rx_sock = open_xl_socket(1, NULL);
> + ASSERT_GE(rx_sock, 0);
> +
> + fill_canxl(&tx, 8, 0x11);
> + tx.prio |= 0x42 << CANXL_VCID_OFFSET;
> +
> + ret = write(tx_sock, &tx, CANXL_HDR_SIZE + tx.len);
> + ASSERT_EQ(ret, CANXL_HDR_SIZE + tx.len);
[Severity: Medium]
Does this test lack a check for CAN XL support before executing?
Other tests in this file check if the interface can handle CAN XL frames:
if (!can_iface_supports_xl())
SKIP(return, "%s does not support CAN XL", CANIF);
Without this check, if the tests are run on a system with only a classic CAN
interface, the write() will be rejected with -EINVAL because the MTU is too
small. Won't this cause a false positive test failure at the ASSERT_EQ check
instead of gracefully skipping the test?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260923025317.374997-1-quchaosheng000406@163.com?part=1
prev parent reply other threads:[~2026-09-23 3:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 2:53 [PATCH] selftests: can: add CAN XL raw socket tests Quchaosheng
2026-09-23 3:02 ` sashiko-bot [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=20260923030246.CFE791F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=mkl@pengutronix.de \
--cc=o.rempel@pengutronix.de \
--cc=quchaosheng000406@163.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=socketcan@hartkopp.net \
/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.