[jimc:folio-pool-v2-lockdep 8/21] kernel/bpf/syscall.c:2090:49: error: passing argument 3 of 'folio_scratchpad_init_key' from incompatible pointer type

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://github.com/jimc/linux.git folio-pool-v2-lockdep
head:   e77ee8289ea0755b0ee299348504d4568f942d71
commit: 2432ceb7a7491e75e80ba99c95a327d7f5eb1bf2 [8/21] bpf/syscall: Route generic_map_update_batch key/value allocations to folio_scratchpad
config: alpha-allmodconfig (https://download.01.org/0day-ci/archive/20260818/[email protected]/config)
compiler: alpha-linux-gcc (GCC) 16.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260818/[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]/

Note: the jimc/folio-pool-v2-lockdep HEAD e77ee8289ea0755b0ee299348504d4568f942d71 builds fine.
      It only hurts bisectability.

All errors (new ones prefixed by >>):

   kernel/bpf/syscall.c: In function 'generic_map_update_batch':
>> kernel/bpf/syscall.c:2090:49: error: passing argument 3 of 'folio_scratchpad_init_key' from incompatible pointer type [-Wincompatible-pointer-types]
    2090 |         folio_scratchpad_init_key(&batch_sp, 0, &bpf_batch_scratchpad_key);
         |                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~
         |                                                 |
         |                                                 struct static_key_true *
   In file included from include/linux/bpf_verifier.h:901,
                    from kernel/bpf/syscall.c:9:
   include/linux/folio_pool.h:104:51: note: expected 'struct static_key *' but argument is of type 'struct static_key_true *'
     104 |                                struct static_key *key);
         |                                ~~~~~~~~~~~~~~~~~~~^~~


vim +/folio_scratchpad_init_key +2090 kernel/bpf/syscall.c

  2064	
  2065	int generic_map_update_batch(struct bpf_map *map, struct file *map_file,
  2066				     const union bpf_attr *attr,
  2067				     union bpf_attr __user *uattr)
  2068	{
  2069		void __user *values = u64_to_user_ptr(attr->batch.values);
  2070		void __user *keys = u64_to_user_ptr(attr->batch.keys);
  2071		struct folio_scratchpad batch_sp;
  2072		u32 value_size, cp, max_count;
  2073		void *key, *value;
  2074		int err = 0;
  2075	
  2076		err = bpf_map_check_op_flags(map, attr->batch.elem_flags,
  2077					     BPF_F_LOCK | BPF_F_CPU | BPF_F_ALL_CPUS);
  2078		if (err)
  2079			return err;
  2080	
  2081		value_size = bpf_map_value_size(map, attr->batch.elem_flags);
  2082	
  2083		max_count = attr->batch.count;
  2084		if (!max_count)
  2085			return 0;
  2086	
  2087		if (put_user(0, &uattr->batch.count))
  2088			return -EFAULT;
  2089	
> 2090		folio_scratchpad_init_key(&batch_sp, 0, &bpf_batch_scratchpad_key);
  2091	
  2092		key = folio_scratchpad_alloc(&batch_sp, map->key_size,
  2093					     sizeof(void *), GFP_USER | __GFP_NOWARN);
  2094		if (!key)
  2095			return -ENOMEM;
  2096	
  2097		value = folio_scratchpad_alloc(&batch_sp, value_size,
  2098					       sizeof(void *), GFP_USER | __GFP_NOWARN);
  2099		if (!value) {
  2100			folio_scratchpad_free(&batch_sp);
  2101			return -ENOMEM;
  2102		}
  2103	
  2104		for (cp = 0; cp < max_count; cp++) {
  2105			err = -EFAULT;
  2106			if (copy_from_user(key, keys + cp * map->key_size,
  2107			    map->key_size) ||
  2108			    copy_from_user(value, values + cp * value_size, value_size))
  2109				break;
  2110	
  2111			err = bpf_map_update_value(map, map_file, key, value,
  2112						   attr->batch.elem_flags);
  2113	
  2114			if (err)
  2115				break;
  2116			cond_resched();
  2117		}
  2118	
  2119		if (copy_to_user(&uattr->batch.count, &cp, sizeof(cp)))
  2120			err = -EFAULT;
  2121	
  2122		folio_scratchpad_free(&batch_sp);
  2123	
  2124		return err;
  2125	}
  2126	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.