Hi Menglong,

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/Menglong-Dong/add-function-metadata-support/20250226-202312
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link:    
https://lore.kernel.org/r/20250226121537.752241-1-dongml2%40chinatelecom.cn
patch subject: [PATCH bpf-next v2] add function metadata support
config: i386-buildonly-randconfig-002-20250227 
(https://download.01.org/0day-ci/archive/20250228/[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20250228/[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/kfunc_md.c: In function 'kfunc_md_get_next':
>> kernel/trace/kfunc_md.c:98:20: warning: cast from pointer to integer of 
>> different size [-Wpointer-to-int-cast]
      98 |         free_pages((u64)mds, order);
         |                    ^

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for CALL_PADDING
   Depends on [n]: CC_HAS_ENTRY_PADDING [=y] && OBJTOOL [=n]
   Selected by [y]:
   - FUNCTION_METADATA [=y]


vim +98 kernel/trace/kfunc_md.c

    47  
    48  /* Get next usable function metadata. On success, return the usable
    49   * kfunc_md and store the index of it to *index. If no usable kfunc_md 
is
    50   * found in kfunc_mds, a larger array will be allocated.
    51   */
    52  static struct kfunc_md *kfunc_md_get_next(u32 *index)
    53  {
    54          struct kfunc_md *new_mds, *mds;
    55          u32 i, order;
    56  
    57          mds = rcu_dereference(kfunc_mds);
    58          if (mds == NULL) {
    59                  order = kfunc_md_page_order();
    60                  new_mds = (void *)__get_free_pages(GFP_KERNEL, order);
    61                  if (!new_mds)
    62                          return NULL;
    63                  kfunc_md_init(new_mds, 0, kfunc_md_count);
    64                  /* The first time to initialize kfunc_mds, so it is not
    65                   * used anywhere yet, and we can update it directly.
    66                   */
    67                  rcu_assign_pointer(kfunc_mds, new_mds);
    68                  mds = new_mds;
    69          }
    70  
    71          if (likely(kfunc_md_used < kfunc_md_count)) {
    72                  /* maybe we can manage the used function metadata entry
    73                   * with a bit map ?
    74                   */
    75                  for (i = 0; i < kfunc_md_count; i++) {
    76                          if (!mds[i].users) {
    77                                  kfunc_md_used++;
    78                                  *index = i;
    79                                  mds[i].users++;
    80                                  return mds + i;
    81                          }
    82                  }
    83          }
    84  
    85          order = kfunc_md_page_order();
    86          /* no available function metadata, so allocate a bigger function
    87           * metadata array.
    88           */
    89          new_mds = (void *)__get_free_pages(GFP_KERNEL, order + 1);
    90          if (!new_mds)
    91                  return NULL;
    92  
    93          memcpy(new_mds, mds, kfunc_md_count * sizeof(*new_mds));
    94          kfunc_md_init(new_mds, kfunc_md_count, kfunc_md_count * 2);
    95  
    96          rcu_assign_pointer(kfunc_mds, new_mds);
    97          synchronize_rcu();
  > 98          free_pages((u64)mds, order);
    99  
   100          mds = new_mds + kfunc_md_count;
   101          *index = kfunc_md_count;
   102          kfunc_md_count <<= 1;
   103          kfunc_md_used++;
   104          mds->users++;
   105  
   106          return mds;
   107  }
   108  

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

Reply via email to