Commit 066d885
bpf: avoid warning for unused register_bpf_struct_ops()
The macro originally introduced in commit f6be98d ("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.
Fixes: 15f295f ("net/smc: bpf: Introduce generic hook for handshake flow")
Cc: Kui-Feng Lee <[email protected]>
Cc: Martin KaFai Lau <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>1 parent 03e2ed2 commit 066d885
2 files changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2065 | 2065 | | |
2066 | 2066 | | |
2067 | 2067 | | |
2068 | | - | |
| 2068 | + | |
2069 | 2069 | | |
2070 | 2070 | | |
2071 | 2071 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
535 | 535 | | |
536 | 536 | | |
537 | 537 | | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
538 | 543 | | |
539 | 544 | | |
540 | 545 | | |
| |||
0 commit comments