Skip to content

Commit 7cedeee

Browse files
geertuKernel Patches Daemon
authored andcommitted
bpf: Fix register_bpf_struct_ops() dummy
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: f6be98d ("bpf, net: switch to dynamic registration") Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent 03e2ed2 commit 7cedeee

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

include/linux/bpf.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2065,7 +2065,11 @@ int bpf_struct_ops_desc_init(struct bpf_struct_ops_desc *st_ops_desc,
20652065
void bpf_map_struct_ops_info_fill(struct bpf_map_info *info, struct bpf_map *map);
20662066
void bpf_struct_ops_desc_release(struct bpf_struct_ops_desc *st_ops_desc);
20672067
#else
2068-
#define register_bpf_struct_ops(st_ops, type) ({ (void *)(st_ops); 0; })
2068+
static inline int __register_bpf_struct_ops(struct bpf_struct_ops *st_ops)
2069+
{
2070+
return 0;
2071+
}
2072+
#define register_bpf_struct_ops(st_ops, type) __register_bpf_struct_ops(st_ops)
20692073
static inline bool bpf_try_module_get(const void *data, struct module *owner)
20702074
{
20712075
return try_module_get(owner);

0 commit comments

Comments
 (0)