summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/amd/amdkfd
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2024-02-06 03:47:55 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2024-02-06 03:47:55 +0000
commit9fec5791ca9c433da9d361ee1cfc029ae1781a77 (patch)
tree75b1696bd88dadfd62901b9d9917e6f0c2c43a15 /sys/dev/pci/drm/amd/amdkfd
parent3b920d4ce62363577fb0cd3dce1edaedfc3c443f (diff)
drm/amdkfd: Fix iterator used outside loop in 'kfd_add_peer_prop()'
From Srinivasan Shanmugam 583e0a336bfbf3f2fb2badc7d1980dadfb3611f0 in linux-6.6.y/6.6.16 b1a428b45dc7e47c7acc2ad0d08d8a6dda910c4c in mainline linux
Diffstat (limited to 'sys/dev/pci/drm/amd/amdkfd')
-rw-r--r--sys/dev/pci/drm/amd/amdkfd/kfd_topology.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_topology.c b/sys/dev/pci/drm/amd/amdkfd/kfd_topology.c
index 6e75e8fa18b..61157fddc15 100644
--- a/sys/dev/pci/drm/amd/amdkfd/kfd_topology.c
+++ b/sys/dev/pci/drm/amd/amdkfd/kfd_topology.c
@@ -1452,17 +1452,19 @@ static int kfd_add_peer_prop(struct kfd_topology_device *kdev,
/* CPU->CPU link*/
cpu_dev = kfd_topology_device_by_proximity_domain(iolink1->node_to);
if (cpu_dev) {
- list_for_each_entry(iolink3, &cpu_dev->io_link_props, list)
- if (iolink3->node_to == iolink2->node_to)
- break;
-
- props->weight += iolink3->weight;
- props->min_latency += iolink3->min_latency;
- props->max_latency += iolink3->max_latency;
- props->min_bandwidth = min(props->min_bandwidth,
- iolink3->min_bandwidth);
- props->max_bandwidth = min(props->max_bandwidth,
- iolink3->max_bandwidth);
+ list_for_each_entry(iolink3, &cpu_dev->io_link_props, list) {
+ if (iolink3->node_to != iolink2->node_to)
+ continue;
+
+ props->weight += iolink3->weight;
+ props->min_latency += iolink3->min_latency;
+ props->max_latency += iolink3->max_latency;
+ props->min_bandwidth = min(props->min_bandwidth,
+ iolink3->min_bandwidth);
+ props->max_bandwidth = min(props->max_bandwidth,
+ iolink3->max_bandwidth);
+ break;
+ }
} else {
WARN(1, "CPU node not found");
}