Re: [PATCH 1/2] virhostdevtest: Initialize hostdev @subsys

2023-02-06 Thread Ján Tomko

On a Monday in 2023, Michal Privoznik wrote:

With recent work on storing original PCI stats in
_virDomainHostdevSubsysPCI struct, the virhostdevtest can across


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 
---
tests/virhostdevtest.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c
index b9e16dd4e8..92bafcbb49 100644
--- a/tests/virhostdevtest.c
+++ b/tests/virhostdevtest.c
@@ -123,7 +123,7 @@ myInit(void)
size_t i;

for (i = 0; i < nhostdevs; i++) {
-virDomainHostdevSubsys subsys;
+virDomainHostdevSubsys subsys = {0};


To avoid rewriting the commit message, I think you can squash this into
the second patch, since the change gets removed anyway.

Jano


hostdevs[i] = virDomainHostdevDefNew();
if (!hostdevs[i])
goto cleanup;
--
2.39.1



signature.asc
Description: PGP signature


[PATCH 1/2] virhostdevtest: Initialize hostdev @subsys

2023-02-06 Thread Michal Privoznik
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 
---
 tests/virhostdevtest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c
index b9e16dd4e8..92bafcbb49 100644
--- a/tests/virhostdevtest.c
+++ b/tests/virhostdevtest.c
@@ -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;
-- 
2.39.1