All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: [leon-rdma:rdma-next 82/102] drivers/pci/search.c:640:19-23: ERROR: invalid reference to the index variable of the iterator on line 634
Date: Fri, 11 Jul 2025 22:10:06 +0800	[thread overview]
Message-ID: <202507112200.Cj7NFLQw-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Jason Gunthorpe <jgg@nvidia.com>
CC: Leon Romanovsky <leon@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git rdma-next
head:   0d6c12f6ad3d5539f881b643620382469671b9bf
commit: 4c5d16c7ade032db128f02ee914adfd47b3abbe5 [82/102] PCI: Add pci_reachable_set()
:::::: branch date: 32 hours ago
:::::: commit date: 32 hours ago
config: loongarch-randconfig-r052-20250711 (https://download.01.org/0day-ci/archive/20250711/202507112200.Cj7NFLQw-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 12.4.0

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>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202507112200.Cj7NFLQw-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> drivers/pci/search.c:640:19-23: ERROR: invalid reference to the index variable of the iterator on line 634

vim +640 drivers/pci/search.c

4c5d16c7ade032 Jason Gunthorpe 2025-06-30  574  
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  575  /**
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  576   * pci_reachable_set - Generate a bitmap of devices within a reachability set
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  577   * @start: First device in the set
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  578   * @devfns: The set of devices on the bus
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  579   * @reachable: Callback to tell if two devices can reach each other
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  580   *
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  581   * Compute a bitmap where every set bit is a device on the bus that is reachable
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  582   * from the start device, including the start device. Reachability between two
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  583   * devices is determined by a callback function.
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  584   *
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  585   * This is a non-recursive implementation that invokes the callback once per
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  586   * pair. The callback must be commutative:
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  587   *    reachable(a, b) == reachable(b, a)
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  588   * reachable() can form a cyclic graph:
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  589   *    reachable(a,b) == reachable(b,c) == reachable(c,a) == true
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  590   *
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  591   * Since this function is limited to a single bus the largest set can be 256
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  592   * devices large.
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  593   */
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  594  void pci_reachable_set(struct pci_dev *start, struct pci_alias_set *devfns,
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  595  		       bool (*reachable)(struct pci_dev *deva,
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  596  					 struct pci_dev *devb))
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  597  {
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  598  	struct pci_alias_set todo_devfns = {};
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  599  	struct pci_alias_set next_devfns = {};
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  600  	struct pci_bus *bus = start->bus;
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  601  	bool again;
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  602  
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  603  	/* Assume devfn of all PCI devices is bounded by MAX_NR_DEVFNS */
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  604  	static_assert(sizeof(next_devfns.devfns) * BITS_PER_BYTE >=
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  605  		      MAX_NR_DEVFNS);
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  606  
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  607  	memset(devfns, 0, sizeof(devfns->devfns));
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  608  	__set_bit(start->devfn, devfns->devfns);
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  609  	__set_bit(start->devfn, next_devfns.devfns);
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  610  
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  611  	down_read(&pci_bus_sem);
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  612  	while (true) {
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  613  		unsigned int devfna;
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  614  		unsigned int i;
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  615  
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  616  		/*
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  617  		 * For each device that hasn't been checked compare every
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  618  		 * device on the bus against it.
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  619  		 */
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  620  		again = false;
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  621  		for_each_set_bit(devfna, next_devfns.devfns, MAX_NR_DEVFNS) {
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  622  			struct pci_dev *deva = NULL;
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  623  			struct pci_dev *devb;
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  624  
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  625  			list_for_each_entry(devb, &bus->devices, bus_list) {
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  626  				if (devb->devfn == devfna)
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  627  					deva = devb;
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  628  
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  629  				if (test_bit(devb->devfn, devfns->devfns))
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  630  					continue;
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  631  
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  632  				if (!deva) {
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  633  					deva = devb;
4c5d16c7ade032 Jason Gunthorpe 2025-06-30 @634  					list_for_each_entry_continue(
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  635  						deva, &bus->devices, bus_list)
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  636  						if (deva->devfn == devfna)
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  637  							break;
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  638  				}
4c5d16c7ade032 Jason Gunthorpe 2025-06-30  639  
4c5d16c7ade032 Jason Gunthorpe 2025-06-30 @640  				if (!reachable(deva, devb))

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

                 reply	other threads:[~2025-07-11 14:10 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=202507112200.Cj7NFLQw-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=julia.lawall@inria.fr \
    --cc=oe-kbuild@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.