[libvirt] [PATCH 1/9] qemu: process: Make it obvious that virDomainDefPostParse is called with NULL opaque

Peter Krempa posted 9 patches 6 years, 2 months ago
[libvirt] [PATCH 1/9] qemu: process: Make it obvious that virDomainDefPostParse is called with NULL opaque
Posted by Peter Krempa 6 years, 2 months ago
Commit c90fb5a828a added explicit use of the private copy of the qemu
capabilities to various places. The change to qemuProcessInit was bogus
though as at the point where we re-initiate the post parse callbacks
priv->qemuCaps is still NULL as we clear it after shutdown of the VM and
don't initiate it until a later point.

Using the value from priv->qemuCaps might mislead readers of the code
into thinking that something useful is being passed at that point so go
with an explicit NULL instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_process.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 161b3910e5..1b88c471f4 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5531,7 +5531,8 @@ qemuProcessInit(virQEMUDriverPtr driver,
     if (vm->def->postParseFailed) {
         VIR_DEBUG("re-running the post parse callback");

-        if (virDomainDefPostParse(vm->def, caps, 0, driver->xmlopt, priv->qemuCaps) < 0)
+        /* we don't have the private copy of qemuCaps at this point */
+        if (virDomainDefPostParse(vm->def, caps, 0, driver->xmlopt, NULL) < 0)
             goto cleanup;
     }

-- 
2.23.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 1/9] qemu: process: Make it obvious that virDomainDefPostParse is called with NULL opaque
Posted by Ján Tomko 6 years, 2 months ago
On Mon, Nov 25, 2019 at 01:53:46PM +0100, Peter Krempa wrote:
>Commit c90fb5a828a added explicit use of the private copy of the qemu
>capabilities to various places. The change to qemuProcessInit was bogus
>though as at the point where we re-initiate the post parse callbacks
>priv->qemuCaps is still NULL as we clear it after shutdown of the VM and
>don't initiate it until a later point.
>
>Using the value from priv->qemuCaps might mislead readers of the code
>into thinking that something useful is being passed at that point so go
>with an explicit NULL instead.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/qemu/qemu_process.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list