@@ -428,14 +428,14 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,
428
428
p_info ("no instructions returned" );
429
429
return -1 ;
430
430
}
431
- buf = ( unsigned char * ) (info -> jited_prog_insns );
431
+ buf = u64_to_ptr (info -> jited_prog_insns );
432
432
member_len = info -> jited_prog_len ;
433
433
} else { /* DUMP_XLATED */
434
434
if (info -> xlated_prog_len == 0 || !info -> xlated_prog_insns ) {
435
435
p_err ("error retrieving insn dump: kernel.kptr_restrict set?" );
436
436
return -1 ;
437
437
}
438
- buf = ( unsigned char * ) info -> xlated_prog_insns ;
438
+ buf = u64_to_ptr ( info -> xlated_prog_insns ) ;
439
439
member_len = info -> xlated_prog_len ;
440
440
}
441
441
@@ -444,7 +444,7 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,
444
444
return -1 ;
445
445
}
446
446
447
- func_info = ( void * ) info -> func_info ;
447
+ func_info = u64_to_ptr ( info -> func_info ) ;
448
448
449
449
if (info -> nr_line_info ) {
450
450
prog_linfo = bpf_prog_linfo__new (info );
@@ -462,7 +462,7 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,
462
462
463
463
n = write (fd , buf , member_len );
464
464
close (fd );
465
- if (n != member_len ) {
465
+ if (n != ( ssize_t ) member_len ) {
466
466
p_err ("error writing output file: %s" ,
467
467
n < 0 ? strerror (errno ) : "short write" );
468
468
return -1 ;
@@ -492,13 +492,13 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,
492
492
__u32 i ;
493
493
if (info -> nr_jited_ksyms ) {
494
494
kernel_syms_load (& dd );
495
- ksyms = ( __u64 * ) info -> jited_ksyms ;
495
+ ksyms = u64_to_ptr ( info -> jited_ksyms ) ;
496
496
}
497
497
498
498
if (json_output )
499
499
jsonw_start_array (json_wtr );
500
500
501
- lens = ( __u32 * ) info -> jited_func_lens ;
501
+ lens = u64_to_ptr ( info -> jited_func_lens ) ;
502
502
for (i = 0 ; i < info -> nr_jited_func_lens ; i ++ ) {
503
503
if (ksyms ) {
504
504
sym = kernel_syms_search (& dd , ksyms [i ]);
@@ -559,7 +559,7 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,
559
559
} else {
560
560
kernel_syms_load (& dd );
561
561
dd .nr_jited_ksyms = info -> nr_jited_ksyms ;
562
- dd .jited_ksyms = ( __u64 * ) info -> jited_ksyms ;
562
+ dd .jited_ksyms = u64_to_ptr ( info -> jited_ksyms ) ;
563
563
dd .btf = btf ;
564
564
dd .func_info = func_info ;
565
565
dd .finfo_rec_size = info -> func_info_rec_size ;
@@ -1681,7 +1681,7 @@ static char *profile_target_name(int tgt_fd)
1681
1681
goto out ;
1682
1682
}
1683
1683
1684
- func_info = ( struct bpf_func_info * ) (info_linear -> info .func_info );
1684
+ func_info = u64_to_ptr (info_linear -> info .func_info );
1685
1685
t = btf__type_by_id (btf , func_info [0 ].type_id );
1686
1686
if (!t ) {
1687
1687
p_err ("btf %d doesn't have type %d" ,
0 commit comments