Re: [PATCH] qemu: cleanup error checking on agent replies

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

 



On 04/01/2014 07:22 AM, Martin Kletzander wrote:
> On all the places where qemuAgentComand() was called, we did a check
> for errors in the reply.  Unfortunately, some of the places called
> qemuAgentCheckError() without checking for non-null reply which might
> have resulted in a crash.
> 
> So this patch makes the error-checking part of qemuAgentCommand()
> itself, which:
> 
>  a) makes it look better,
> 
>  b) makes the check mandatory and, most importantly,
> 
>  c) checks for the errors if and only if it is appropriate.
> 
> This actually fixes a potential crashers when qemuAgentComand()
> returned 0, but reply was NULL.  Having said that, it *should* fix the
> following bug:
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1058149
> 
> Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
> ---
>  src/qemu/qemu_agent.c | 27 +++++++--------------------
>  1 file changed, 7 insertions(+), 20 deletions(-)
> 

> 
> +static int qemuAgentCheckError(virJSONValuePtr cmd, virJSONValuePtr reply);
> +

Is it worth hoisting this function into topological order, so we don't
need a forward declaration?   But that's better as a followup patch
(no-op code motion should be separate from refactoring).

ACK

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]