Re: [PATCH 1/2] bpf: Fix register_bpf_struct_ops() dummy
From: Martin KaFai Lau <martin.lau@linux.dev>
Date: 2025-12-04 18:18:59
Also in:
bpf, linux-rdma, linux-s390, lkml
On 12/4/25 2:29 AM, Geert Uytterhoeven wrote:
quoted hunk ↗ jump to hunk
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@linux-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.