All of lore.kernel.org
 help / color / mirror / Atom feed
* [kkdwivedi:fermata 17/146] kernel/bpf/arraymap.c:827:17: sparse: sparse: non size-preserving pointer to integer cast
@ 2026-10-21  1:43 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-10-21  1:43 UTC (permalink / raw)
  To: Kumar Kartikeya Dwivedi; +Cc: oe-kbuild-all

tree:   https://github.com/kkdwivedi/linux fermata
head:   7b45e27f0f0faaa13da429815b6143b99eaa232c
commit: a664b63f784e6d51674acc16c5ad6e1776c8ffd9 [17/146] bpf: Call the callback of bpf_for_each_map_elem with a pad
config: nios2-randconfig-r2308-20261021 (https://download.01.org/0day-ci/archive/20261021/202610210323.U5vqxig4-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.5.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261021/202610210323.U5vqxig4-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202610210323.U5vqxig4-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> kernel/bpf/arraymap.c:827:17: sparse: sparse: non size-preserving pointer to integer cast
>> kernel/bpf/arraymap.c:827:17: sparse: sparse: non size-preserving pointer to integer cast
--
>> kernel/bpf/hashtab.c:2541:25: sparse: sparse: non size-preserving pointer to integer cast
   kernel/bpf/hashtab.c:3442:17: sparse: sparse: non size-preserving pointer to integer cast
   kernel/bpf/hashtab.c:3442:17: sparse: sparse: non size-preserving pointer to integer cast

vim +827 kernel/bpf/arraymap.c

   803	
   804	static long bpf_for_each_array_elem(struct bpf_map *map, bpf_callback_t callback_fn,
   805					    void *callback_ctx, u64 flags)
   806	{
   807		u32 i, key, num_elems = 0;
   808		struct bpf_array *array;
   809		bool is_percpu;
   810		u64 ret = 0;
   811		void *val;
   812	
   813		cant_migrate();
   814	
   815		if (flags != 0)
   816			return -EINVAL;
   817	
   818		is_percpu = map->map_type == BPF_MAP_TYPE_PERCPU_ARRAY;
   819		array = container_of(map, struct bpf_array, map);
   820		for (i = 0; i < map->max_entries; i++) {
   821			if (is_percpu)
   822				val = this_cpu_ptr(array->pptrs[i]);
   823			else
   824				val = array_map_elem_ptr(array, i);
   825			num_elems++;
   826			key = i;
 > 827			bpf_call_cb(callback_fn, map, &key, val, callback_ctx, 0, ret, unwound);
   828			/* return value: 0 - continue, 1 - stop and return */
   829			if (ret)
   830				break;
   831		}
   832	
   833		return num_elems;
   834	
   835	unwound:
   836		/* The callback left with unwind_exit: nothing to drop here */
   837		bpf_unwind_leave();
   838		return 0;
   839	}
   840	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-21  1:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-21  1:43 [kkdwivedi:fermata 17/146] kernel/bpf/arraymap.c:827:17: sparse: sparse: non size-preserving pointer to integer cast kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.