Hi Leon,

kernel test robot noticed the following build warnings:

[auto build test WARNING on bpf-next/master]

url:    
https://github.com/intel-lab-lkp/linux/commits/Leon-Hwang/bpf-Initialize-ftrace_managed-in-bpf_trampoline_get/20261012-234003
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link:    
https://lore.kernel.org/r/20261012154024.29423-15-leon.hwang%40linux.dev
patch subject: [PATCH bpf-next v2 14/21] bpf: Add tracing_multi link info 
support for bpf progs
config: i386-randconfig-1011-20261013 
(https://download.01.org/0day-ci/archive/20261015/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20261015/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: 
https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

   kernel/trace/bpf_trace.c: In function 
'bpf_tracing_multi_link_fill_link_info':
>> kernel/trace/bpf_trace.c:3755:32: warning: cast from pointer to integer of 
>> different size [-Wpointer-to-int-cast]
    3755 |                         addr = (u64) mnode->trampoline->func.addr;
         |                                ^


vim +3755 kernel/trace/bpf_trace.c

  3708  
  3709  static int bpf_tracing_multi_link_fill_link_info(const struct bpf_link 
*link,
  3710                                                   struct bpf_link_info 
*info)
  3711  {
  3712          u32 __user *fids = 
u64_to_user_ptr(info->tracing_multi.func_btf_ids);
  3713          u64 __user *ucookies = 
u64_to_user_ptr(info->tracing_multi.cookies);
  3714          u64 __user *uaddrs = u64_to_user_ptr(info->tracing_multi.addrs);
  3715          u32 __user *uids = u64_to_user_ptr(info->tracing_multi.ids);
  3716          struct bpf_tracing_multi_link *tr_link;
  3717          u32 ucount = info->tracing_multi.count;
  3718          bool has_cookies, show_addrs, has_progs;
  3719          int err = 0;
  3720  
  3721          if ((uids || ucookies || uaddrs || fids) && !ucount)
  3722                  return -EINVAL;
  3723  
  3724          tr_link = container_of(link, struct bpf_tracing_multi_link, 
link);
  3725  
  3726          info->tracing_multi.attach_type = tr_link->link.attach_type;
  3727          info->tracing_multi.count = tr_link->nodes_cnt;
  3728          info->tracing_multi.btf_obj_id = 
btf_obj_id(tr_link->link.prog->aux->attach_btf);
  3729          has_progs = !!tr_link->tgt_progs;
  3730          info->tracing_multi.flags = has_progs ? 
BPF_F_TRACING_MULTI_TGT_PROGS : 0;
  3731  
  3732          if (!uids && !ucookies && !uaddrs && !fids)
  3733                  return 0;
  3734          if (has_progs != !!fids)
  3735                  return -EINVAL;
  3736  
  3737          if (ucount < tr_link->nodes_cnt)
  3738                  err = -ENOSPC;
  3739          else
  3740                  ucount = tr_link->nodes_cnt;
  3741  
  3742          has_cookies = !!tr_link->cookies;
  3743          show_addrs = kallsyms_show_value(current_cred());
  3744  
  3745          for (int i = 0; i < ucount; i++) {
  3746                  struct bpf_tracing_multi_node *mnode = 
&tr_link->nodes[i];
  3747                  u32 prog_id, btf_id;
  3748                  u64 addr, cookie;
  3749  
  3750                  bpf_trampoline_unpack_key(mnode->trampoline->key, 
&prog_id, &btf_id);
  3751  
  3752                  if (!show_addrs)
  3753                          addr = 0;
  3754                  else if (has_progs)
> 3755                          addr = (u64) mnode->trampoline->func.addr;
  3756                  else
  3757                          addr = mnode->trampoline->ip;
  3758                  cookie = has_cookies ? tr_link->cookies[i] : 0;
  3759  
  3760                  if (uids && put_user(has_progs ? prog_id : btf_id, uids 
+ i))
  3761                          return -EFAULT;
  3762                  if (uaddrs && put_user(addr, uaddrs + i))
  3763                          return -EFAULT;
  3764                  if (ucookies && put_user(cookie, ucookies + i))
  3765                          return -EFAULT;
  3766                  if (has_progs && put_user((u32) mnode->trampoline->key, 
fids + i))
  3767                          return -EFAULT;
  3768  
  3769                  cond_resched();
  3770          }
  3771  
  3772          return err;
  3773  }
  3774  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Reply via email to