[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ae991e0c-66e9-4e27-ab8a-ab166c12dd60@linux.dev>
Date: Thu, 4 Dec 2025 10:18:40 -0800
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: Kui-Feng Lee <thinker.li@...il.com>, "D . Wythe"
<alibuda@...ux.alibaba.com>, Dust Li <dust.li@...ux.alibaba.com>,
Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
John Fastabend <john.fastabend@...il.com>,
Sidraya Jayagond <sidraya@...ux.ibm.com>, Wenjia Zhang
<wenjia@...ux.ibm.com>, Mahanta Jambigi <mjambigi@...ux.ibm.com>,
Tony Lu <tonylu@...ux.alibaba.com>, Wen Gu <guwen@...ux.alibaba.com>,
"David S . Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
bpf@...r.kernel.org, linux-rdma@...r.kernel.org, linux-s390@...r.kernel.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] bpf: Fix register_bpf_struct_ops() dummy
On 12/4/25 2:29 AM, Geert Uytterhoeven wrote:
> If CONFIG_BPF_SYSCALL=y, but CONFIG_BPF_JIT=n:
>
> net/smc/smc_hs_bpf.c: In function ‘bpf_smc_hs_ctrl_init’:
> include/linux/bpf.h:2068:50: error: statement with no effect [-Werror=unused-value]
> 2068 | #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);
> | ^~~~~~~~~~~~~~~~~~~~~~~
>
> As type is not a variable, but a variable type, this cannot be fixed by
> just converting register_bpf_struct_ops() into a static inline function.
> Hence fix this by introducing a static inline intermediate dummy.
>
> Fixes: f6be98d19985411c ("bpf, net: switch to dynamic registration")
> Signed-off-by: Geert Uytterhoeven <geert@...ux-m68k.org>
> ---
> include/linux/bpf.h | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> index 6498be4c44f8c275..bb69905c28a761e7 100644
> --- a/include/linux/bpf.h
> +++ b/include/linux/bpf.h
> @@ -2065,7 +2065,11 @@ int bpf_struct_ops_desc_init(struct bpf_struct_ops_desc *st_ops_desc,
> void bpf_map_struct_ops_info_fill(struct bpf_map_info *info, struct bpf_map *map);
> void bpf_struct_ops_desc_release(struct bpf_struct_ops_desc *st_ops_desc);
> #else
> -#define register_bpf_struct_ops(st_ops, type) ({ (void *)(st_ops); 0; })
> +static inline int __register_bpf_struct_ops(struct bpf_struct_ops *st_ops)
> +{
> + return 0;
> +}
> +#define register_bpf_struct_ops(st_ops, type) __register_bpf_struct_ops(st_ops)
Only patch 2 is needed. This empty register_bpf_struct_ops should be
removed in the bpf-next tree as a cleanup.
Powered by blists - more mailing lists