[libvirt] [PATCH] qemu: cleanup error checking on agent replies
Eric Blake
eblake at redhat.com
Tue Apr 1 14:26:57 UTC 2014
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 at redhat.com>
> ---
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140401/ff60c80e/attachment-0001.sig>
More information about the libvir-list
mailing list