All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Hannes Reinecke <hare@kernel.org>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [hare-scsi-devel:nvme-mpath-bpf 5/6] drivers/nvme/host/bpf_ops.c:36:39: warning: variable 'nit' set but not used
Date: Wed, 30 Jul 2025 05:22:46 +0800	[thread overview]
Message-ID: <202507300512.inemb73W-lkp@intel.com> (raw)

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

                 reply	other threads:[~2025-07-29 21:23 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=202507300512.inemb73W-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=hare@kernel.org \
    --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.