[libvirt PATCH] qemu: qemuBuildChardevCommand: use chrSourcePriv unconditionally

Ján Tomko posted 1 patch 2 years, 4 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/77b8f188ac52b160f0a455516d8db03c3259a7a9.1639398617.git.jtomko@redhat.com
src/qemu/qemu_command.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt PATCH] qemu: qemuBuildChardevCommand: use chrSourcePriv unconditionally
Posted by Ján Tomko 2 years, 4 months ago
In the QEMU driver, we allocate private source data unconditionally
for every chardev and the rest of the function just assumes it's there.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
Pointed out by Coverity.

 src/qemu/qemu_command.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 613f7a5d2a..0017cf6ca7 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1493,7 +1493,7 @@ qemuBuildChardevCommand(virCommand *cmd,
              * secinfo is added only to a TCP serial device during
              * qemuDomainSecretChardevPrepare. Subsequently called
              * functions can just check the config fields */
-            if (chrSourcePriv && chrSourcePriv->secinfo) {
+            if (chrSourcePriv->secinfo) {
                 if (qemuBuildObjectSecretCommandLine(cmd,
                                                      chrSourcePriv->secinfo,
                                                      qemuCaps) < 0)
-- 
2.31.1

Re: [libvirt PATCH] qemu: qemuBuildChardevCommand: use chrSourcePriv unconditionally
Posted by Peter Krempa 2 years, 4 months ago
On Mon, Dec 13, 2021 at 13:30:28 +0100, Ján Tomko wrote:
> In the QEMU driver, we allocate private source data unconditionally
> for every chardev and the rest of the function just assumes it's there.
> 
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
> Pointed out by Coverity.
> 
>  src/qemu/qemu_command.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>