From: Mehdi Ben Hadj Khelifa <mehdi.benhadjkhelifa@gmail.com>
To: Daniel Borkmann <daniel@iogearbox.net>,
andrii@kernel.org, eddyz87@gmail.com, ast@kernel.org,
martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev,
john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me,
haoluo@google.com, jolsa@kernel.org, shuah@kernel.org,
matttbe@kernel.org, martineau@kernel.org, geliang@kernel.org,
davem@davemloft.net, kuba@kernel.org, hawk@kernel.org,
linux@jordanrome.com, ameryhung@gmail.com, toke@redhat.com,
houtao1@huawei.com, emil@etsalapatis.com, yatsenko@meta.com,
isolodrai@meta.com, a.s.protopopov@gmail.com, dxu@dxuuu.xyz,
memxor@gmail.com, vmalik@redhat.com, bigeasy@linutronix.de,
tj@kernel.org, gregkh@linuxfoundation.org, paul@paul-moore.com,
bboscaccy@linux.microsoft.com,
James.Bottomley@HansenPartnership.com, mrpre@163.com,
jakub@cloudflare.com
Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, netdev@vger.kernel.org,
mptcp@lists.linux.dev,
linux-kernel-mentees@lists.linuxfoundation.org,
skhan@linuxfoundation.org, david.hunter.linux@gmail.com
Subject: Re: [PATCH v3 3/3] selftests/bpf: Prepare to add -Wsign-compare for bpf tests
Date: Thu, 25 Sep 2025 17:26:48 +0100 [thread overview]
Message-ID: <4b77c830-2a7d-444a-adeb-4d1370f8923f@gmail.com> (raw)
In-Reply-To: <5ad26663-a3cc-4bf4-9d6f-8213ac8e8ce6@iogearbox.net>
On 9/25/25 4:04 PM, Daniel Borkmann wrote:
> On 9/25/25 12:35 PM, Mehdi Ben Hadj Khelifa wrote:
>> -Change only variable types for correct sign comparisons
>>
>> Signed-off-by: Mehdi Ben Hadj Khelifa <mehdi.benhadjkhelifa@gmail.com>
>
> Pls write some better commit messages and not just copy/paste the same
> $subj/
> message every time; proper sentences w/o the weird " -" indent.
Understood, though the changes are very similar / are the same with the
same goal that's why it made sense to me to do that and I will remove
the - in future commits.> Also say
> why
> this is needed in the commit message, and add a reference to the commit
> which
> initially added this as a TODO, i.e. 495d2d8133fd ("selftests/bpf:
> Attempt to
> build BPF programs with -Wsign-compare").
I will do that in the upcoming version.
> If you group these, then maybe
> also
> include the parts of the compiler-emitted warnings during build which are
> relevant to the code changes you do here.
Okay. I will do that. Should i send a v4 with the recommended changes
but not including the rest of the files meaning the ones that I haven't
uploaded in this patch series which contain type casting or should i
just make changes for these files in this series?
Also will it be better if dropped these versions and made a new patch
with v1?
Thank you for your review and time Daniel.
Regards,
Mehdi
>> ---
>> tools/testing/selftests/bpf/progs/test_xdp_dynptr.c | 2 +-
>> tools/testing/selftests/bpf/progs/test_xdp_loop.c | 2 +-
>> tools/testing/selftests/bpf/progs/test_xdp_noinline.c | 4 ++--
>> tools/testing/selftests/bpf/progs/uprobe_multi.c | 4 ++--
>> .../selftests/bpf/progs/uprobe_multi_session_recursive.c | 5 +++--
>> .../selftests/bpf/progs/verifier_iterating_callbacks.c | 2 +-
>> 6 files changed, 10 insertions(+), 9 deletions(-)
>>
>> diff --git a/tools/testing/selftests/bpf/progs/test_xdp_dynptr.c b/
>> tools/testing/selftests/bpf/progs/test_xdp_dynptr.c
>> index 67a77944ef29..12ad0ec91021 100644
>> --- a/tools/testing/selftests/bpf/progs/test_xdp_dynptr.c
>> +++ b/tools/testing/selftests/bpf/progs/test_xdp_dynptr.c
>> @@ -89,7 +89,7 @@ static __always_inline int handle_ipv4(struct xdp_md
>> *xdp, struct bpf_dynptr *xd
>> struct vip vip = {};
>> int dport;
>> __u32 csum = 0;
>> - int i;
>> + size_t i;
>> __builtin_memset(eth_buffer, 0, sizeof(eth_buffer));
>> __builtin_memset(iph_buffer_tcp, 0, sizeof(iph_buffer_tcp));
>> diff --git a/tools/testing/selftests/bpf/progs/test_xdp_loop.c b/
>> tools/testing/selftests/bpf/progs/test_xdp_loop.c
>> index 93267a68825b..e9b7bbff5c23 100644
>> --- a/tools/testing/selftests/bpf/progs/test_xdp_loop.c
>> +++ b/tools/testing/selftests/bpf/progs/test_xdp_loop.c
>> @@ -85,7 +85,7 @@ static __always_inline int handle_ipv4(struct xdp_md
>> *xdp)
>> struct vip vip = {};
>> int dport;
>> __u32 csum = 0;
>> - int i;
>> + size_t i;
>> if (iph + 1 > data_end)
>> return XDP_DROP;
>> diff --git a/tools/testing/selftests/bpf/progs/test_xdp_noinline.c b/
>> tools/testing/selftests/bpf/progs/test_xdp_noinline.c
>> index fad94e41cef9..85ef3c0a3e20 100644
>> --- a/tools/testing/selftests/bpf/progs/test_xdp_noinline.c
>> +++ b/tools/testing/selftests/bpf/progs/test_xdp_noinline.c
>> @@ -372,7 +372,7 @@ bool encap_v4(struct xdp_md *xdp, struct ctl_value
>> *cval,
>> next_iph_u16 = (__u16 *) iph;
>> __pragma_loop_unroll_full
>> - for (int i = 0; i < sizeof(struct iphdr) >> 1; i++)
>> + for (size_t i = 0; i < sizeof(struct iphdr) >> 1; i++)
>> csum += *next_iph_u16++;
>> iph->check = ~((csum & 0xffff) + (csum >> 16));
>> if (bpf_xdp_adjust_head(xdp, (int)sizeof(struct iphdr)))
>> @@ -423,7 +423,7 @@ int send_icmp_reply(void *data, void *data_end)
>> iph->check = 0;
>> next_iph_u16 = (__u16 *) iph;
>> __pragma_loop_unroll_full
>> - for (int i = 0; i < sizeof(struct iphdr) >> 1; i++)
>> + for (size_t i = 0; i < sizeof(struct iphdr) >> 1; i++)
>> csum += *next_iph_u16++;
>> iph->check = ~((csum & 0xffff) + (csum >> 16));
>> return swap_mac_and_send(data, data_end);
>> diff --git a/tools/testing/selftests/bpf/progs/uprobe_multi.c b/tools/
>> testing/selftests/bpf/progs/uprobe_multi.c
>> index 44190efcdba2..f99957773c3a 100644
>> --- a/tools/testing/selftests/bpf/progs/uprobe_multi.c
>> +++ b/tools/testing/selftests/bpf/progs/uprobe_multi.c
>> @@ -20,13 +20,13 @@ __u64 uretprobe_multi_func_3_result = 0;
>> __u64 uprobe_multi_sleep_result = 0;
>> -int pid = 0;
>> +__u32 pid = 0;
>> int child_pid = 0;
>> int child_tid = 0;
>> int child_pid_usdt = 0;
>> int child_tid_usdt = 0;
>> -int expect_pid = 0;
>> +__u32 expect_pid = 0;
>> bool bad_pid_seen = false;
>> bool bad_pid_seen_usdt = false;
>> diff --git a/tools/testing/selftests/bpf/progs/
>> uprobe_multi_session_recursive.c b/tools/testing/selftests/bpf/progs/
>> uprobe_multi_session_recursive.c
>> index 8fbcd69fae22..017f1859ebe8 100644
>> --- a/tools/testing/selftests/bpf/progs/uprobe_multi_session_recursive.c
>> +++ b/tools/testing/selftests/bpf/progs/uprobe_multi_session_recursive.c
>> @@ -3,6 +3,7 @@
>> #include <bpf/bpf_helpers.h>
>> #include <bpf/bpf_tracing.h>
>> #include <stdbool.h>
>> +#include <stddef.h>
>> #include "bpf_kfuncs.h"
>> #include "bpf_misc.h"
>> @@ -10,8 +11,8 @@ char _license[] SEC("license") = "GPL";
>> int pid = 0;
>> -int idx_entry = 0;
>> -int idx_return = 0;
>> +size_t idx_entry = 0;
>> +size_t idx_return = 0;
>> __u64 test_uprobe_cookie_entry[6];
>> __u64 test_uprobe_cookie_return[3];
>> diff --git a/tools/testing/selftests/bpf/progs/
>> verifier_iterating_callbacks.c b/tools/testing/selftests/bpf/progs/
>> verifier_iterating_callbacks.c
>> index 75dd922e4e9f..72f9f8c23c93 100644
>> --- a/tools/testing/selftests/bpf/progs/verifier_iterating_callbacks.c
>> +++ b/tools/testing/selftests/bpf/progs/verifier_iterating_callbacks.c
>> @@ -593,7 +593,7 @@ int loop_inside_iter_volatile_limit(const void *ctx)
>> {
>> struct bpf_iter_num it;
>> int *v, sum = 0;
>> - __u64 i = 0;
>> + __s32 i = 0;
>> bpf_iter_num_new(&it, 0, ARR2_SZ);
>> while ((v = bpf_iter_num_next(&it))) {
>
next prev parent reply other threads:[~2025-09-25 15:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-25 10:35 [PATCH v3 0/3] selftests/bpf: Prepare to add -Wsign-compare for bpf selftests Mehdi Ben Hadj Khelifa
2025-09-25 10:35 ` [PATCH v3 1/3] selftests/bpf: Prepare to add -Wsign-compare for bpf tests Mehdi Ben Hadj Khelifa
2025-09-25 10:35 ` [PATCH v3 2/3] " Mehdi Ben Hadj Khelifa
2025-09-25 10:35 ` [PATCH v3 3/3] " Mehdi Ben Hadj Khelifa
2025-09-25 15:04 ` Daniel Borkmann
2025-09-25 16:26 ` Mehdi Ben Hadj Khelifa [this message]
2025-09-25 16:18 ` vivek yadav
2025-09-25 23:32 ` [PATCH v3 0/3] selftests/bpf: Prepare to add -Wsign-compare for bpf selftests Andrii Nakryiko
2025-09-26 8:00 ` Mehdi Ben Hadj Khelifa
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=4b77c830-2a7d-444a-adeb-4d1370f8923f@gmail.com \
--to=mehdi.benhadjkhelifa@gmail.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=a.s.protopopov@gmail.com \
--cc=ameryhung@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bboscaccy@linux.microsoft.com \
--cc=bigeasy@linutronix.de \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=david.hunter.linux@gmail.com \
--cc=dxu@dxuuu.xyz \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=geliang@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=haoluo@google.com \
--cc=hawk@kernel.org \
--cc=houtao1@huawei.com \
--cc=isolodrai@meta.com \
--cc=jakub@cloudflare.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux@jordanrome.com \
--cc=martin.lau@linux.dev \
--cc=martineau@kernel.org \
--cc=matttbe@kernel.org \
--cc=memxor@gmail.com \
--cc=mptcp@lists.linux.dev \
--cc=mrpre@163.com \
--cc=netdev@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=song@kernel.org \
--cc=tj@kernel.org \
--cc=toke@redhat.com \
--cc=vmalik@redhat.com \
--cc=yatsenko@meta.com \
--cc=yonghong.song@linux.dev \
/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.