Skip to content

Commit 00e8c44

Browse files
jrfastabAlexei Starovoitov
authored and
Alexei Starovoitov
committed
bpf, selftests: Fix cast to smaller integer type 'int' warning in raw_tp
Fix warning in bpf selftests, progs/test_raw_tp_test_run.c:18:10: warning: cast to smaller integer type 'int' from 'struct task_struct *' [-Wpointer-to-int-cast] Change int type cast to long to fix. Discovered with gcc-9 and llvm-11+ where llvm was recent main branch. Fixes: 09d8ad1 ("selftests/bpf: Add raw_tp_test_run") Signed-off-by: John Fastabend <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Link: https://lore.kernel.org/bpf/160134424745.11199.13841922833336698133.stgit@john-Precision-5820-Tower
1 parent bc60090 commit 00e8c44

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ int BPF_PROG(rename, struct task_struct *task, char *comm)
1515
count++;
1616
if ((__u64) task == 0x1234ULL && (__u64) comm == 0x5678ULL) {
1717
on_cpu = bpf_get_smp_processor_id();
18-
return (int)task + (int)comm;
18+
return (long)task + (long)comm;
1919
}
2020

2121
return 0;

0 commit comments

Comments
 (0)