Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: mkl@pengutronix.de
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
	linux-can@vger.kernel.org, kernel@pengutronix.de,
	s.grosjean@peak-system.fr, stable@vger.kernel.org
Subject: Re: [PATCH net-next 02/23] selftests: can: add J1939 test helper header and library
Date: Thu, 03 Dec 2026 23:12:15 +0000	[thread overview]
Message-ID: <179633953573.3146.8765255233108616500@kernel.org> (raw)
In-Reply-To: <20261202230853.2665144-3-mkl@pengutronix.de>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] j1939_gw.c can fail to build because nothing it includes
  defines static_assert().

--

selftests: can: add J1939 test helper header and library

This commit adds shared code for the upcoming J1939 selftests: C helpers
in j1939_helpers.c/h, kselftest harness glue in j1939_tests.h, and a
j1939_lib.sh runner that sets up vcan interfaces. It also adds a small
j1939_gw tool that installs CAN gateway rules between the J1939 vcan and
the CAN_RAW peer's vcan.

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

[ ... ]

> +#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 {

[ ... ]

> +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]
Which header defines static_assert for j1939_gw.c?

The only candidate is <linux/kernel.h>, which is presumably meant to
resolve to tools/include/linux/kernel.h. That file pulls in <assert.h>
and <linux/build_bug.h>.

The Makefile puts -I$(top_srcdir)/usr/include ahead of
-I$(top_srcdir)/tools/include. After make headers, which is the usual
step before an in-tree selftest build, usr/include/linux/kernel.h
exists. It is the installed include/uapi/linux/kernel.h, and it only
includes <linux/sysinfo.h> and <linux/const.h>. That means the uAPI
header shadows the tools one.

None of the other headers included here pulls in <assert.h>. GCC 14 and
earlier default to gnu17, where static_assert is not a keyword, so
these two file-scope static_assert() lines fail to compile.

j1939_helpers.h is not affected because it includes <linux/build_bug.h>
directly, and that header has no uAPI counterpart.

j1939_gw is in TEST_GEN_FILES, so a compile failure here also stops the
existing test_raw_filter target from building in net/can. Later patches
in the series do not change this include list or the Makefile include
order.

Could j1939_gw.c include <linux/build_bug.h> or <assert.h> directly?
Moving tools/include ahead of usr/include would also fix it.

> +
> +/* Add a rule from src to dst; return 0 or a negative errno. */
> +static int cgw_add(int nl, unsigned int src, unsigned int dst)

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202230853.2665144-2-mkl%40pengutronix.de

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

Thread overview: 30+ 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-03 23:12   ` netdev-bot+sashiko [this message]
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-03 23:12   ` netdev-bot+sashiko
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-03 23:12   ` netdev-bot+sashiko
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-03 23:12   ` netdev-bot+sashiko
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-03 23:12   ` netdev-bot+sashiko
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=179633953573.3146.8765255233108616500@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=davem@davemloft.net \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=s.grosjean@peak-system.fr \
    --cc=stable@vger.kernel.org \
    /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