Skip to content

Commit 0303ce1

Browse files
Hailong Liuanakryiko
authored andcommitted
samples, bpf: Suppress compiler warning
While cross compiling on ARM32 , the casting from pointer to __u64 will cause warnings: samples/bpf/task_fd_query_user.c: In function 'main': samples/bpf/task_fd_query_user.c:399:23: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] 399 | uprobe_file_offset = (__u64)main - (__u64)&__executable_start; | ^ samples/bpf/task_fd_query_user.c:399:37: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] 399 | uprobe_file_offset = (__u64)main - (__u64)&__executable_start; Workaround this by using "unsigned long" to adapt to different ARCHs. Signed-off-by: Hailong Liu <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent e5670fa commit 0303ce1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

samples/bpf/task_fd_query_user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ int main(int argc, char **argv)
396396
* on different systems with different compilers. The right way is
397397
* to parse the ELF file. We took a shortcut here.
398398
*/
399-
uprobe_file_offset = (__u64)main - (__u64)&__executable_start;
399+
uprobe_file_offset = (unsigned long)main - (unsigned long)&__executable_start;
400400
CHECK_AND_RET(test_nondebug_fs_probe("uprobe", (char *)argv[0],
401401
uprobe_file_offset, 0x0, false,
402402
BPF_FD_TYPE_UPROBE,

0 commit comments

Comments
 (0)