All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitrii Banshchikov <me@ubique.spb.ru>
To: bpf@vger.kernel.org
Cc: Dmitrii Banshchikov <me@ubique.spb.ru>,
	ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	kafai@fb.com, songliubraving@fb.com, yhs@fb.com,
	john.fastabend@gmail.com, kpsingh@chromium.org, rdna@fb.com
Subject: [PATCH] selftests/bpf: Fix a compiler warning in global func test
Date: Tue, 23 Feb 2021 12:22:11 +0400	[thread overview]
Message-ID: <20210223082211.302596-1-me@ubique.spb.ru> (raw)
In-Reply-To: <CAEf4BzbbwTeVqP0D_UmYMamfWqp0JSO6TSr_TS-7aoxa-xW3Jg@mail.gmail.com>

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(-)

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);
 }
-- 
2.25.1


  reply	other threads:[~2021-02-23  8:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-12 20:56 [PATCH v3 bpf-next 0/4] Add support of pointer to struct in global functions Dmitrii Banshchikov
2021-02-12 20:56 ` [PATCH v3 bpf-next 1/4] bpf: Rename bpf_reg_state variables Dmitrii Banshchikov
2021-02-12 21:11   ` Andrii Nakryiko
2021-02-12 20:56 ` [PATCH v3 bpf-next 2/4] bpf: Extract nullable reg type conversion into a helper function Dmitrii Banshchikov
2021-02-12 21:12   ` Andrii Nakryiko
2021-02-12 20:56 ` [PATCH v3 bpf-next 3/4] bpf: Support pointers in global func args Dmitrii Banshchikov
2021-02-12 21:14   ` Andrii Nakryiko
2021-02-13  2:09   ` Alexei Starovoitov
2021-02-15  6:25     ` Dmitrii Banshchikov
2021-02-12 20:56 ` [PATCH v3 bpf-next 4/4] selftests/bpf: Add unit tests for pointers in global functions Dmitrii Banshchikov
2021-02-12 21:15   ` Andrii Nakryiko
2021-02-23  6:43   ` Andrii Nakryiko
2021-02-23  8:22     ` Dmitrii Banshchikov [this message]
2021-02-24 15:50       ` [PATCH] selftests/bpf: Fix a compiler warning in global func test patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210223082211.302596-1-me@ubique.spb.ru \
    --to=me@ubique.spb.ru \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@chromium.org \
    --cc=rdna@fb.com \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.