Re: [PATCH 4/7] qemu: assume 'info chardev' is always available

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 11/05/2015 12:33 PM, Daniel P. Berrange wrote:
> As of QEMU 0.11.0 the 'info chardev' monitor command can be
> used to report on allocated chardev paths, so we can drop
> support for parsing QEMU stderr to locate the PTY paths.
> 
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---
>  src/qemu/qemu_process.c | 193 ------------------------------------------------
>  1 file changed, 193 deletions(-)
> 

Ran the series through the Coverity checks...

> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 524072c..72c7041 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c

[...]

>  static int
>  qemuProcessRefreshChannelVirtioState(virQEMUDriverPtr driver,
> @@ -2140,15 +1956,6 @@ qemuProcessWaitForMonitor(virQEMUDriverPtr driver,
>          (logfd = qemuDomainOpenLog(driver, vm, pos)) < 0)
>          return -1;
>  
> -    if (logfd != -1 && !virQEMUCapsUsedQMP(qemuCaps)) {
> -        if (VIR_ALLOC_N(buf, buf_size) < 0)
> -            goto closelog;
> -
> -        if (qemuProcessReadLogOutput(vm, logfd, buf, buf_size,
> -                                     qemuProcessFindCharDevicePTYs,
> -                                     "console", 30) < 0)
> -            goto closelog;
> -    }
>  
>      VIR_DEBUG("Connect monitor to %p '%s'", vm, vm->def->name);
>      if (qemuConnectMonitor(driver, vm, asyncJob, logfd) < 0)
> 

Complaint from Coverity is in the cleanup: section


(11) Event cond_false: 	Condition "virQEMUCapsUsedQMP(qemuCaps)", taking
false branch

1993 	        if (virQEMUCapsUsedQMP(qemuCaps)) {
1994 	            if (VIR_ALLOC_N(buf, buf_size) < 0)
1995 	                goto closelog;

(12) Event if_end: 	End of if statement

1996 	        }
1997 	

(13) Event var_deref_model: 	Passing null pointer "buf" to "strlen",
which dereferences it.
Also see events: 	[assign_zero]


So if virQEMUCapsUsedQMP fails, then buf is NULL

John

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]