diff mbox series

selftests/bpf: Fix a compiler warning in global func test

Message ID 20210223082211.302596-1-me@ubique.spb.ru (mailing list archive)
State Accepted
Commit c41d81bfbb4579c3e583457e383dd63d026bf947
Delegated to: BPF
Headers show
Series selftests/bpf: Fix a compiler warning in global func test | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Dmitrii Banshchikov Feb. 23, 2021, 8:22 a.m. UTC
Add an explicit 'const void *' cast to pass program ctx pointer type into
a global function that expects pointer to structure.

warning: incompatible pointer types
passing 'struct __sk_buff *' to parameter of type 'const struct S *'
[-Wincompatible-pointer-types]
        return foo(skb);
                   ^~~
progs/test_global_func11.c:10:36: note: passing argument to parameter 's' here
__noinline int foo(const struct S *s)
                                   ^

Fixes: 8b08807d039a ("selftests/bpf: Add unit tests for pointers in global functions")
Signed-off-by: Dmitrii Banshchikov <me@ubique.spb.ru>
---
 tools/testing/selftests/bpf/progs/test_global_func11.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org Feb. 24, 2021, 3:50 p.m. UTC | #1
Hello:

This patch was applied to bpf/bpf.git (refs/heads/master):

On Tue, 23 Feb 2021 12:22:11 +0400 you wrote:
> Add an explicit 'const void *' cast to pass program ctx pointer type into
> a global function that expects pointer to structure.
> 
> warning: incompatible pointer types
> passing 'struct __sk_buff *' to parameter of type 'const struct S *'
> [-Wincompatible-pointer-types]
>         return foo(skb);
>                    ^~~
> progs/test_global_func11.c:10:36: note: passing argument to parameter 's' here
> __noinline int foo(const struct S *s)
>                                    ^
> 
> [...]

Here is the summary with links:
  - selftests/bpf: Fix a compiler warning in global func test
    https://git.kernel.org/bpf/bpf/c/c41d81bfbb45

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/progs/test_global_func11.c b/tools/testing/selftests/bpf/progs/test_global_func11.c
index 28488047c849..ef5277d982d9 100644
--- a/tools/testing/selftests/bpf/progs/test_global_func11.c
+++ b/tools/testing/selftests/bpf/progs/test_global_func11.c
@@ -15,5 +15,5 @@  __noinline int foo(const struct S *s)
 SEC("cgroup_skb/ingress")
 int test_cls(struct __sk_buff *skb)
 {
-	return foo(skb);
+	return foo((const void *)skb);
 }