All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [kkdwivedi:fermata 17/146] kernel/bpf/arraymap.c:827:17: sparse: sparse: non size-preserving pointer to integer cast
Date: Wed, 21 Oct 2026 03:43:10 +0200	[thread overview]
Message-ID: <202610210323.U5vqxig4-lkp@intel.com> (raw)

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

                 reply	other threads:[~2026-10-21  1:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202610210323.U5vqxig4-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=memxor@gmail.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.