[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250925103559.14876-3-mehdi.benhadjkhelifa@gmail.com>
Date: Thu, 25 Sep 2025 11:35:40 +0100
From: Mehdi Ben Hadj Khelifa <mehdi.benhadjkhelifa@...il.com>
To: andrii@...nel.org,
eddyz87@...il.com,
ast@...nel.org,
daniel@...earbox.net,
martin.lau@...ux.dev,
song@...nel.org,
yonghong.song@...ux.dev,
john.fastabend@...il.com,
kpsingh@...nel.org,
sdf@...ichev.me,
haoluo@...gle.com,
jolsa@...nel.org,
shuah@...nel.org,
matttbe@...nel.org,
martineau@...nel.org,
geliang@...nel.org,
davem@...emloft.net,
kuba@...nel.org,
hawk@...nel.org,
linux@...danrome.com,
ameryhung@...il.com,
toke@...hat.com,
houtao1@...wei.com,
emil@...alapatis.com,
yatsenko@...a.com,
isolodrai@...a.com,
a.s.protopopov@...il.com,
dxu@...uu.xyz,
memxor@...il.com,
vmalik@...hat.com,
bigeasy@...utronix.de,
tj@...nel.org,
gregkh@...uxfoundation.org,
paul@...l-moore.com,
bboscaccy@...ux.microsoft.com,
James.Bottomley@...senPartnership.com,
mrpre@....com,
jakub@...udflare.com
Cc: bpf@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org,
netdev@...r.kernel.org,
mptcp@...ts.linux.dev,
linux-kernel-mentees@...ts.linuxfoundation.org,
skhan@...uxfoundation.org,
david.hunter.linux@...il.com,
Mehdi Ben Hadj Khelifa <mehdi.benhadjkhelifa@...il.com>
Subject: [PATCH v3 2/3] selftests/bpf: Prepare to add -Wsign-compare for bpf tests
-Change only variable types for correct sign comparisons
Signed-off-by: Mehdi Ben Hadj Khelifa <mehdi.benhadjkhelifa@...il.com>
---
.../testing/selftests/bpf/progs/test_parse_tcp_hdr_opt_dynptr.c | 2 +-
tools/testing/selftests/bpf/progs/test_skb_ctx.c | 2 +-
tools/testing/selftests/bpf/progs/test_snprintf.c | 2 +-
tools/testing/selftests/bpf/progs/test_sockmap_strp.c | 2 +-
tools/testing/selftests/bpf/progs/test_tc_tunnel.c | 2 +-
tools/testing/selftests/bpf/progs/test_xdp.c | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/bpf/progs/test_parse_tcp_hdr_opt_dynptr.c b/tools/testing/selftests/bpf/progs/test_parse_tcp_hdr_opt_dynptr.c
index dc6e43bc6a62..bf3ac5c2938c 100644
--- a/tools/testing/selftests/bpf/progs/test_parse_tcp_hdr_opt_dynptr.c
+++ b/tools/testing/selftests/bpf/progs/test_parse_tcp_hdr_opt_dynptr.c
@@ -100,7 +100,7 @@ int xdp_ingress_v6(struct xdp_md *xdp)
off += sizeof(struct tcphdr);
/* max number of bytes of options in tcp header is 40 bytes */
- for (int i = 0; i < tcp_hdr_opt_max_opt_checks; i++) {
+ for (__u32 i = 0; i < tcp_hdr_opt_max_opt_checks; i++) {
err = parse_hdr_opt(&ptr, &off, &hdr_bytes_remaining, &server_id);
if (err || !hdr_bytes_remaining)
diff --git a/tools/testing/selftests/bpf/progs/test_skb_ctx.c b/tools/testing/selftests/bpf/progs/test_skb_ctx.c
index a724a70c6700..7939a2edc414 100644
--- a/tools/testing/selftests/bpf/progs/test_skb_ctx.c
+++ b/tools/testing/selftests/bpf/progs/test_skb_ctx.c
@@ -11,7 +11,7 @@ SEC("tc")
int process(struct __sk_buff *skb)
{
__pragma_loop_unroll_full
- for (int i = 0; i < 5; i++) {
+ for (__u32 i = 0; i < 5; i++) {
if (skb->cb[i] != i + 1)
return 1;
skb->cb[i]++;
diff --git a/tools/testing/selftests/bpf/progs/test_snprintf.c b/tools/testing/selftests/bpf/progs/test_snprintf.c
index 8fda07544023..1aa4835da71a 100644
--- a/tools/testing/selftests/bpf/progs/test_snprintf.c
+++ b/tools/testing/selftests/bpf/progs/test_snprintf.c
@@ -4,7 +4,7 @@
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>
-__u32 pid = 0;
+int pid = 0;
char num_out[64] = {};
long num_ret = 0;
diff --git a/tools/testing/selftests/bpf/progs/test_sockmap_strp.c b/tools/testing/selftests/bpf/progs/test_sockmap_strp.c
index dde3d5bec515..e9675c45d8ef 100644
--- a/tools/testing/selftests/bpf/progs/test_sockmap_strp.c
+++ b/tools/testing/selftests/bpf/progs/test_sockmap_strp.c
@@ -2,7 +2,7 @@
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_endian.h>
-int verdict_max_size = 10000;
+__u32 verdict_max_size = 10000;
struct {
__uint(type, BPF_MAP_TYPE_SOCKMAP);
__uint(max_entries, 20);
diff --git a/tools/testing/selftests/bpf/progs/test_tc_tunnel.c b/tools/testing/selftests/bpf/progs/test_tc_tunnel.c
index 404124a93892..c7e2d4571a2b 100644
--- a/tools/testing/selftests/bpf/progs/test_tc_tunnel.c
+++ b/tools/testing/selftests/bpf/progs/test_tc_tunnel.c
@@ -80,7 +80,7 @@ static __always_inline void set_ipv4_csum(struct iphdr *iph)
{
__u16 *iph16 = (__u16 *)iph;
__u32 csum;
- int i;
+ size_t i;
iph->check = 0;
diff --git a/tools/testing/selftests/bpf/progs/test_xdp.c b/tools/testing/selftests/bpf/progs/test_xdp.c
index 8caf58be5818..ce2a9ae26088 100644
--- a/tools/testing/selftests/bpf/progs/test_xdp.c
+++ b/tools/testing/selftests/bpf/progs/test_xdp.c
@@ -89,7 +89,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;
--
2.51.0
Powered by blists - more mailing lists