Linux CAN drivers development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Marc Kleine-Budde" <mkl@pengutronix.de>
Cc: linux-can@vger.kernel.org,
	"Oliver Hartkopp" <socketcan@hartkopp.net>,
	"Vincent Mailhol" <mailhol@kernel.org>,
	"Oleksij Rempel" <o.rempel@pengutronix.de>
Subject: Re: [PATCH net-next 02/23] selftests: can: add J1939 test helper header and library
Date: Wed, 02 Dec 2026 23:26:46 +0000	[thread overview]
Message-ID: <sashiko-outbox-246713@kernel.org> (raw)
In-Reply-To: <20261202230853.2665144-3-mkl@pengutronix.de>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] selftests: can: undeclared static_assert() in j1939_gw.c due
  to UAPI header
--

commit 8a0b49ac9325ad4226e875680d89eb3fe0cedc60
Author: Oleksij Rempel <o.rempel@pengutronix.de>

selftests: can: add J1939 test helper header and library

This commit adds shared C and shell helpers, a kselftest harness header, and
a CAN gateway setup helper for J1939 selftests.

Link: https://patch.msgid.link/20261130-j1939-selftests-v7-2-2491693ccb8d@pengutronix.de

> diff --git a/tools/testing/selftests/net/can/Makefile b/tools/testing/selftests/net/can/Makefile
> index 3adaa13dcbfa3..cf0b06974d546 100644
> --- a/tools/testing/selftests/net/can/Makefile
> +++ b/tools/testing/selftests/net/can/Makefile
> @@ -2,12 +2,16 @@
>  
>  top_srcdir = ../../../../..
>  
> -CFLAGS += -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES)
> +CFLAGS += -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include -I$(top_srcdir)/tools/include $(KHDR_INCLUDES)
[ ... ]
> diff --git a/tools/testing/selftests/net/can/j1939_gw.c b/tools/testing/selftests/net/can/j1939_gw.c
> new file mode 100644
> index 0000000000000..4018432add9a2
> --- /dev/null
> +++ b/tools/testing/selftests/net/can/j1939_gw.c
> @@ -0,0 +1,129 @@
[ ... ]
> +#include <linux/can.h>
> +#include <linux/can/gw.h>
> +#include <linux/kernel.h>
> +#include <linux/netlink.h>
> +#include <linux/rtnetlink.h>
> +
> +/* an RTM_NEWROUTE request for a CAN->CAN rule, see net/can/gw.c */
> +struct cgw_req {
> +	struct nlmsghdr nh;
> +	struct rtcanmsg rtcan;
> +	struct rtattr src_attr;
> +	__u32 src_ifindex;
> +	struct rtattr dst_attr;
> +	__u32 dst_ifindex;
> +};
> +
> +struct cgw_ack {
> +	struct nlmsghdr nh;
> +	struct nlmsgerr err;
> +};
> +
> +static_assert(offsetof(struct cgw_req, src_attr) ==
> +	      NLMSG_SPACE(sizeof(struct rtcanmsg)),
> +	      "the attributes must follow the aligned rtcanmsg");
> +static_assert(offsetof(struct cgw_req, dst_attr) ==
> +	      offsetof(struct cgw_req, src_attr) + RTA_SPACE(sizeof(__u32)),
> +	      "the attributes must be packed as netlink aligns them");

[Severity: Medium]
Can j1939_gw.c fail to build with an undeclared static_assert() on C11/C17
compilers?

CFLAGS puts -I$(top_srcdir)/usr/include ahead of
-I$(top_srcdir)/tools/include.  When UAPI headers have been exported to
usr/include (such as during make kselftest), <linux/kernel.h> resolves to
usr/include/linux/kernel.h instead of tools/include/linux/kernel.h, which does
not include <assert.h> or <linux/build_bug.h>.  Including <linux/build_bug.h>
(as j1939_helpers.h does) or <assert.h> directly in j1939_gw.c would avoid the
shadowing issue.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202230853.2665144-1-mkl@pengutronix.de?part=2

  reply	other threads:[~2026-12-02 23:26 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 23:04 [PATCH net-next 0/23] pull-request: can-next 2026-12-03 Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 01/23] selftests: can: install net/lib.sh with the CAN tests Marc Kleine-Budde
2026-12-02 23:15   ` netdev-bot+sinfo
2026-12-02 23:04 ` [PATCH net-next 02/23] selftests: can: add J1939 test helper header and library Marc Kleine-Budde
2026-12-02 23:26   ` sashiko-bot [this message]
2026-12-02 23:29     ` Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 03/23] selftests: can: add J1939 base functional tests Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 04/23] selftests: can: add J1939 socket option and metadata tests Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 05/23] selftests: can: add J1939 addressing and concurrency tests Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 06/23] selftests: can: add J1939 wire-format tests against CAN_RAW Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 07/23] selftests: can: add J1939 TP/ETP multi-frame " Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 08/23] selftests: can: cover J1939 transport abort and timeout paths Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 09/23] selftests: can: check SO_J1939_PROMISC receive effect Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 10/23] can: peak_usb: fix missing CAN_ERR_FLAG when reporting error counters Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 11/23] can: peak_usb: harden PCAN-USB message validation Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 12/23] can: peak_usb: replace open-coded bitmask operations with bitops Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 13/23] can: peak_usb: harden channel handling in PCAN-USB FD Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 14/23] can: peak_usb: fix RX cursor desync for self-received RTR frames with SRR Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 15/23] can: peak_usb: reject records for unset channels in PCAN-USB Pro Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 16/23] can: peak_usb: register the netdevs only once all channels are set up Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 17/23] can: peak_usb: validate the data length of PCAN-USB Pro CAN records Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 18/23] can: peak_usb: don't read past the message in PCAN-USB Pro decoders Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 19/23] can: peak_usb: dump undecodable URBs once and rate limit decode errors Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 20/23] can: peak_usb: don't return an uninitialized PCAN-USB CAN channel ID Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 21/23] can: peak_usb: pass the dev_num argument of PCAN-USB Pro GETDEVID Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 22/23] can: peak_usb: don't send uninitialized stack bytes to PCAN-USB devices Marc Kleine-Budde
2026-12-02 23:04 ` [PATCH net-next 23/23] can: peak_usb: don't send uninitialized heap bytes in restart commands Marc Kleine-Budde

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-246713@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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox