[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2eca9f77-72bf-4808-a1b6-d87be2777537@linux.dev>
Date: Thu, 4 Dec 2025 11:22:53 -0800
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>,
Dust Li <dust.li@...ux.alibaba.com>, "D. Wythe" <alibuda@...ux.alibaba.com>,
Arnd Bergmann <arnd@...db.de>, Kui-Feng Lee <thinker.li@...il.com>,
Martin KaFai Lau <martin.lau@...nel.org>,
Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
John Fastabend <john.fastabend@...il.com>, KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>, Kumar Kartikeya Dwivedi <memxor@...il.com>,
Mykyta Yatsenko <yatsenko@...a.com>, Tao Chen <chen.dylane@...ux.dev>,
Anton Protopopov <a.s.protopopov@...il.com>, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bpf: avoid warning for unused register_bpf_struct_ops()
On 12/4/25 1:42 AM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> The macro originally introduced in commit f6be98d19985 ("bpf, net:
> switch to dynamic registration") causes a warning in the new smc code
> because of the way it evaluates the arguments:
>
> In file included from include/linux/bpf_verifier.h:7,
> from net/smc/smc_hs_bpf.c:13:
> net/smc/smc_hs_bpf.c: In function 'bpf_smc_hs_ctrl_init':
> include/linux/bpf.h:2076:50: error: statement with no effect [-Werror=unused-value]
> 2076 | #define register_bpf_struct_ops(st_ops, type) ({ (void *)(st_ops); 0; })
> | ^~~~~~~~~~~~~~~~
> net/smc/smc_hs_bpf.c:139:16: note: in expansion of macro 'register_bpf_struct_ops'
> 139 | return register_bpf_struct_ops(&bpf_smc_hs_ctrl_ops, smc_hs_ctrl);
> | ^~~~~~~~~~~~~~~~~~~~~~~
>
> Work around this using an inline function that takes the argument,
> the same way as the normal implementation. Since the second argument to
> register_bpf_struct_ops() is a type rather than an object, this still
> has to be a macro, but it can call a new inline helper internally like
> the normal one does.
Thanks for the patch. This has been fixed in
"https://lore.kernel.org/bpf/988c61e5fea280872d81b3640f1f34d0619cfbbf.1764843951.git.geert@linux-m68k.org/"
to completely remove its usage from smc. The smc usage without
CONFIG_BPF_JIT was an overlook. This empty register_bpf_struct_ops
should be removed from the bpf-next tree as a cleanup.
Powered by blists - more mailing lists