* [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
@ 2025-07-11 14:10 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-07-11 14:10 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Julia Lawall
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-07-11 14:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-11 14:10 [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 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.