* [PATCH] bpf: fix constraint in test_tcpbpf_kern.c
@ 2024-01-23 20:56 Jose E. Marchesi
2024-01-23 21:16 ` Yonghong Song
2024-01-24 0:00 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Jose E. Marchesi @ 2024-01-23 20:56 UTC (permalink / raw)
To: bpf
Cc: Jose E . Marchesi, Yonghong Song, Eduard Zingerman, david.faust,
cupertino.miranda
GCC emits a warning:
progs/test_tcpbpf_kern.c:60:9: error: ‘op’ is used uninitialized [-Werror=uninitialized]
when an uninialized op is used iwth 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 <jose.marchesi@oracle.com>
Cc: Yonghong Song <yhs@meta.com>
Cc: Eduard Zingerman <eddyz87@gmail.com>
Cc: david.faust@oracle.com
Cc: cupertino.miranda@oracle.com
---
tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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)
:);
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] bpf: fix constraint in test_tcpbpf_kern.c
2024-01-23 20:56 [PATCH] bpf: fix constraint in test_tcpbpf_kern.c Jose E. Marchesi
@ 2024-01-23 21:16 ` Yonghong Song
2024-01-24 0:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Yonghong Song @ 2024-01-23 21:16 UTC (permalink / raw)
To: Jose E. Marchesi, bpf
Cc: Yonghong Song, Eduard Zingerman, david.faust, cupertino.miranda
On 1/23/24 12:56 PM, Jose E. Marchesi wrote:
> GCC emits a warning:
>
> progs/test_tcpbpf_kern.c:60:9: error: ‘op’ is used uninitialized [-Werror=uninitialized]
>
> when an uninialized op is used iwth a "+r" constraint. The + modifier
iwth -> with
> 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 <jose.marchesi@oracle.com>
> Cc: Yonghong Song <yhs@meta.com>
> Cc: Eduard Zingerman <eddyz87@gmail.com>
> Cc: david.faust@oracle.com
> Cc: cupertino.miranda@oracle.com
Acked-by: Yonghong Song <yonghong.song@linux.dev>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bpf: fix constraint in test_tcpbpf_kern.c
2024-01-23 20:56 [PATCH] bpf: fix constraint in test_tcpbpf_kern.c Jose E. Marchesi
2024-01-23 21:16 ` Yonghong Song
@ 2024-01-24 0:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-01-24 0:00 UTC (permalink / raw)
To: Jose E. Marchesi; +Cc: bpf, yhs, eddyz87, david.faust, cupertino.miranda
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Tue, 23 Jan 2024 21:56:24 +0100 you wrote:
> GCC emits a warning:
>
> progs/test_tcpbpf_kern.c:60:9: error: ‘op’ is used uninitialized [-Werror=uninitialized]
>
> when an uninialized op is used iwth a "+r" constraint. The + modifier
> means a read-write operand, but that operand in the selftest is just
> written to.
>
> [...]
Here is the summary with links:
- bpf: fix constraint in test_tcpbpf_kern.c
https://git.kernel.org/bpf/bpf-next/c/756e34da5380
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-24 0:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-23 20:56 [PATCH] bpf: fix constraint in test_tcpbpf_kern.c Jose E. Marchesi
2024-01-23 21:16 ` Yonghong Song
2024-01-24 0:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox