Skip to content

Commit 363e46d

Browse files
MehdibenhadjkhelifaKernel Patches Daemon
authored andcommitted
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 <[email protected]>
1 parent c100fcb commit 363e46d

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

tools/testing/selftests/bpf/progs/test_parse_tcp_hdr_opt_dynptr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ int xdp_ingress_v6(struct xdp_md *xdp)
100100
off += sizeof(struct tcphdr);
101101

102102
/* max number of bytes of options in tcp header is 40 bytes */
103-
for (int i = 0; i < tcp_hdr_opt_max_opt_checks; i++) {
103+
for (__u32 i = 0; i < tcp_hdr_opt_max_opt_checks; i++) {
104104
err = parse_hdr_opt(&ptr, &off, &hdr_bytes_remaining, &server_id);
105105

106106
if (err || !hdr_bytes_remaining)

tools/testing/selftests/bpf/progs/test_skb_ctx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ SEC("tc")
1111
int process(struct __sk_buff *skb)
1212
{
1313
__pragma_loop_unroll_full
14-
for (int i = 0; i < 5; i++) {
14+
for (__u32 i = 0; i < 5; i++) {
1515
if (skb->cb[i] != i + 1)
1616
return 1;
1717
skb->cb[i]++;

tools/testing/selftests/bpf/progs/test_snprintf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <linux/bpf.h>
55
#include <bpf/bpf_helpers.h>
66

7-
__u32 pid = 0;
7+
int pid = 0;
88

99
char num_out[64] = {};
1010
long num_ret = 0;

tools/testing/selftests/bpf/progs/test_sockmap_strp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <linux/bpf.h>
33
#include <bpf/bpf_helpers.h>
44
#include <bpf/bpf_endian.h>
5-
int verdict_max_size = 10000;
5+
__u32 verdict_max_size = 10000;
66
struct {
77
__uint(type, BPF_MAP_TYPE_SOCKMAP);
88
__uint(max_entries, 20);

tools/testing/selftests/bpf/progs/test_tc_tunnel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static __always_inline void set_ipv4_csum(struct iphdr *iph)
8080
{
8181
__u16 *iph16 = (__u16 *)iph;
8282
__u32 csum;
83-
int i;
83+
size_t i;
8484

8585
iph->check = 0;
8686

tools/testing/selftests/bpf/progs/test_xdp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static __always_inline int handle_ipv4(struct xdp_md *xdp)
8989
struct vip vip = {};
9090
int dport;
9191
__u32 csum = 0;
92-
int i;
92+
size_t i;
9393

9494
if (iph + 1 > data_end)
9595
return XDP_DROP;

0 commit comments

Comments
 (0)