]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virhostdevtest: Initialize hostdev @subsys
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 6 Feb 2023 14:55:31 +0000 (15:55 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 6 Feb 2023 15:33:26 +0000 (16:33 +0100)
With recent work on storing original PCI stats in
_virDomainHostdevSubsysPCI struct, the virhostdevtest can across
a latent bug we had. Only some parts of the
virDomainHostdevSubsys structure are initialized. Incidentally,
subsys->u.pci.origstates is not one of them. This lead to
unexpected crashes at runtime.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
tests/virhostdevtest.c

index b9e16dd4e8f4db4d3709dbeb0a4d9e9292252e35..92bafcbb49f4d5a348dc26f292033f4f51b05287 100644 (file)
@@ -123,7 +123,7 @@ myInit(void)
     size_t i;
 
     for (i = 0; i < nhostdevs; i++) {
-        virDomainHostdevSubsys subsys;
+        virDomainHostdevSubsys subsys = {0};
         hostdevs[i] = virDomainHostdevDefNew();
         if (!hostdevs[i])
             goto cleanup;