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
parent reply other threads:[~2026-12-03 23:12 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20261202230853.2665144-3-mkl@pengutronix.de>]
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