mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
virnvme: Duplicate index in nested loop in virNVMeDeviceListCreateReAttachList
When loop in function virNVMeDeviceListCreateReAttachList() there may be reused index @i, this patch fix this by using a new @j. Signed-off-by: Jia Zhou <zhou.jia2@zte.com.cn> Signed-off-by: Yi Wang <wang.yi59@zte.com.cn> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
a64de8994f
commit
bae39ea871
@ -397,12 +397,13 @@ virNVMeDeviceListCreateReAttachList(virNVMeDeviceList *activeList,
|
||||
const virNVMeDevice *d = toReAttachList->devs[i];
|
||||
g_autoptr(virPCIDevice) pci = NULL;
|
||||
size_t nused = 0;
|
||||
size_t j;
|
||||
|
||||
/* Check if there is any other NVMe device with the same PCI address as
|
||||
* @d. To simplify this, let's just count how many NVMe devices with
|
||||
* the same PCI address there are on the @activeList. */
|
||||
for (i = 0; i < activeList->count; i++) {
|
||||
virNVMeDevice *other = activeList->devs[i];
|
||||
for (j = 0; j < activeList->count; j++) {
|
||||
virNVMeDevice *other = activeList->devs[j];
|
||||
|
||||
if (!virPCIDeviceAddressEqual(&d->address, &other->address))
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user