mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-05 04:41:20 +00:00
ch: virCHProcessSetupIOThreads: use correct type for return value
virCHMonitorGetIOThreads returns an int, not size_t. Also return early if it's negative, because promoting it to an unsigned type in the for loop condition could lead to an infinte loop. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
7b1c1642b1
commit
47d194139c
@ -327,9 +327,11 @@ virCHProcessSetupIOThreads(virDomainObj *vm)
|
||||
virCHDomainObjPrivate *priv = vm->privateData;
|
||||
virDomainIOThreadInfo **iothreads = NULL;
|
||||
size_t i;
|
||||
size_t niothreads;
|
||||
int niothreads;
|
||||
|
||||
if ((niothreads = virCHMonitorGetIOThreads(priv->monitor, &iothreads)) < 0)
|
||||
return -1;
|
||||
|
||||
niothreads = virCHMonitorGetIOThreads(priv->monitor, &iothreads);
|
||||
for (i = 0; i < niothreads; i++) {
|
||||
VIR_DEBUG("IOThread index = %ld , tid = %d", i, iothreads[i]->iothread_id);
|
||||
if (virCHProcessSetupIOThread(vm, iothreads[i]) < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user