Skip to content

Commit c100fcb

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 0a501c6 commit c100fcb

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "bpf_misc.h"
66

77
struct S {
8-
int x;
8+
__u32 x;
99
};
1010

1111
__noinline int foo(const struct S *s)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "bpf_misc.h"
66

77
struct S {
8-
int x;
8+
__u32 x;
99
};
1010

1111
__noinline int foo(const struct S *s)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "bpf_misc.h"
66

77
struct S {
8-
int x;
8+
__u32 x;
99
};
1010

1111
__noinline int foo(const struct S *s)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "bpf_misc.h"
66

77
struct S {
8-
int x;
8+
__u32 x;
99
};
1010

1111
struct C {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ int sysenter_getpgid(const void *ctx)
2222
/* Just do it for once, when called from our own test prog. This
2323
* ensures the map value is only updated for a single CPU.
2424
*/
25-
int cur_pid = bpf_get_current_pid_tgid() >> 32;
25+
__u32 cur_pid = bpf_get_current_pid_tgid() >> 32;
2626

2727
if (cur_pid == inPid)
2828
bpf_map_update_elem(&hashmap1, &inKey, &inValue, BPF_NOEXIST);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ int xdp_ingress_v6(struct xdp_md *xdp)
102102
opt_state.byte_offset = sizeof(struct tcphdr) + tcp_offset;
103103

104104
/* max number of bytes of options in tcp header is 40 bytes */
105-
for (int i = 0; i < tcp_hdr_opt_max_opt_checks; i++) {
105+
for (__u32 i = 0; i < tcp_hdr_opt_max_opt_checks; i++) {
106106
err = parse_hdr_opt(xdp, &opt_state);
107107

108108
if (err || !opt_state.hdr_bytes_remaining)

0 commit comments

Comments
 (0)