* [hare-scsi-devel:nvme-mpath-bpf 5/6] drivers/nvme/host/bpf_ops.c:36:39: warning: variable 'nit' set but not used
@ 2025-07-29 21:22 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-07-29 21:22 UTC (permalink / raw)
To: Hannes Reinecke; +Cc: oe-kbuild-all
tree: https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git nvme-mpath-bpf
head: 7e438588a7436fb1145593e81e9cd827bde45af9
commit: 85207b99a33685a9fde16be6d130fe5fd8442545 [5/6] nvme-bpf: eBPF struct_ops path selectors
config: x86_64-randconfig-004-20250730 (https://download.01.org/0day-ci/archive/20250730/202507300512.inemb73W-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250730/202507300512.inemb73W-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/202507300512.inemb73W-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/nvme/host/bpf_ops.c: In function 'nvme_bpf_ops_btf_struct_access':
>> drivers/nvme/host/bpf_ops.c:36:39: warning: variable 'nit' set but not used [-Wunused-but-set-variable]
36 | const struct btf_type *nhit, *nit, *niter, *t;
| ^~~
In file included from include/linux/bpf_verifier.h:7,
from drivers/nvme/host/bpf_ops.c:4:
drivers/nvme/host/bpf_ops.c: In function 'nvme_bpf_struct_ops_init':
>> include/linux/bpf.h:1966:50: warning: statement with no effect [-Wunused-value]
1966 | #define register_bpf_struct_ops(st_ops, type) ({ (void *)(st_ops); 0; })
| ^~~~~~~~~~~~~~~~
drivers/nvme/host/bpf_ops.c:341:15: note: in expansion of macro 'register_bpf_struct_ops'
341 | ret = register_bpf_struct_ops(&bpf_nvme_bpf_ops, nvme_bpf_ops);
| ^~~~~~~~~~~~~~~~~~~~~~~
vim +/nit +36 drivers/nvme/host/bpf_ops.c
31
32 static int nvme_bpf_ops_btf_struct_access(struct bpf_verifier_log *log,
33 const struct bpf_reg_state *reg,
34 int off, int size)
35 {
> 36 const struct btf_type *nhit, *nit, *niter, *t;
37
38 nhit = btf_type_by_id(reg->btf, nvme_bpf_ops_args_ids[0]);
39 nit = btf_type_by_id(reg->btf, nvme_bpf_ops_args_ids[1]);
40 niter = btf_type_by_id(reg->btf, nvme_bpf_ops_args_ids[2]);
41
42 t = btf_type_by_id(reg->btf, reg->btf_id);
43 if (t != nhit && t != niter) {
44 bpf_log(log, "write access to struct %d is not supported\n", reg->btf_id);
45 return -EACCES;
46 }
47 if (t == niter) {
48 /* Allow writes to the 'head' element */
49 if (off >= offsetof(struct nvme_bpf_iter, head) &&
50 off + size < offsetofend(struct nvme_bpf_iter, head))
51 return NOT_INIT;
52 } else {
53 /* Allow writes to the 'bpf_ops' element */
54 if (off >= offsetof(struct nvme_ns_head, bpf_ops) &&
55 off + size < offsetofend(struct nvme_ns_head, bpf_ops)) {
56 return NOT_INIT;
57 }
58 }
59 bpf_log(log, "write access for struct %s at off %d with size %d\n",
60 nvme_bpf_ops_name, off, size);
61 return -EACCES;
62 }
63
--
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:[~2025-07-29 21:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-29 21:22 [hare-scsi-devel:nvme-mpath-bpf 5/6] drivers/nvme/host/bpf_ops.c:36:39: warning: variable 'nit' set but not used 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.