Unreachable code in remoteDeserializeDomainDiskErrors
libvirt version - 9.3.0 to latest
Description of problem
In /src/remote/remote_driver.c the macro VIR_FREE(errors[j].disk)
used in line 1661 in function remoteDeserializeDomainDiskErrors
is unreachable. https://gitlab.com/libvirt/libvirt/-/blob/19ce02c773fdeb4d1dfaabac42c650a976a07973/src/remote/remote_driver.c#L1659-1664
-
The variable
i
has been assigned the value 0 in line 1643. -
If the condition in the line 1646 is true, the function will go to the
error
block. https://gitlab.com/libvirt/libvirt/-/blob/19ce02c773fdeb4d1dfaabac42c650a976a07973/src/remote/remote_driver.c#L1646-1650 -
Since the variable
i
has not been assigned a value other than 0 anywhere else, the loop condition(j = 0; j < i; j++)
in line 1660 is not fulfilled, so the code in line 1661 will not be executed. https://gitlab.com/libvirt/libvirt/-/blob/19ce02c773fdeb4d1dfaabac42c650a976a07973/src/remote/remote_driver.c#L1660-1661
Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.
Author A. Burke.