aboutsummaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorJose E. Marchesi <[email protected]>2024-01-23 21:56:24 +0100
committerAlexei Starovoitov <[email protected]>2024-01-23 15:53:04 -0800
commit756e34da5380e4c0ed2cfbe5259e1b015567a099 (patch)
tree7a2fa6f17bda4a2e9fd2f656aebe254ad62e1c61 /tools/testing
parentedb799035dd7d41c3e81e1bef83e2a2120b08abb (diff)
bpf: fix constraint in test_tcpbpf_kern.c
GCC emits a warning: progs/test_tcpbpf_kern.c:60:9: error: ‘op’ is used uninitialized [-Werror=uninitialized] when an uninialized op is used with a "+r" constraint. The + modifier means a read-write operand, but that operand in the selftest is just written to. This patch changes the selftest to use a "=r" constraint. This pacifies GCC. Tested in bpf-next master. No regressions. Signed-off-by: Jose E. Marchesi <[email protected]> Cc: Yonghong Song <[email protected]> Cc: Eduard Zingerman <[email protected]> Cc: [email protected] Cc: [email protected] Acked-by: Yonghong Song <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c b/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
index cf7ed8cbb1fe..a3f3f43fc195 100644
--- a/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
+++ b/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
@@ -59,7 +59,7 @@ int bpf_testcb(struct bpf_sock_ops *skops)
asm volatile (
"%[op] = *(u32 *)(%[skops] +96)"
- : [op] "+r"(op)
+ : [op] "=r"(op)
: [skops] "r"(skops)
:);