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/2026…@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/2026…%40pengutronix.de