From: Igor Mammedov <imammedo@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Error handling in cpu_x86_create
Date: Tue, 30 Jul 2013 14:21:43 +0200 [thread overview]
Message-ID: <20130730142143.10a5734d@nial.usersys.redhat.com> (raw)
In-Reply-To: <51F79CD8.7070807@siemens.com>
On Tue, 30 Jul 2013 13:00:40 +0200
Jan Kiszka <jan.kiszka@siemens.com> wrote:
> Hi Igor,
>
> just noticed by chance that error handling in cpu_x86_create is likely
> broken after your changes. Any error after cpu = ...object_new() will
> not properly release the CPU object again nor report NULL to the caller.
> That means errors should slip through, no? And cpu_x86_init looks similar.
Failure of object_new() in cpu_x86_create() is not checked since it should
never fail.
As for following error handling caller of cpu_x86_create(..., errp) should
use errp to check for errors and release failed cpu.
cpu_x86_init() that calls it has:
===
out:
if (error) {
fprintf(stderr, "%s\n", error_get_pretty(error));
error_free(error);
if (cpu != NULL) {
object_unref(OBJECT(cpu));
===
similar code-path exists in pc_new_cpu()
end goal is to replace cpu_x86_create() with just object_new(FOO_CPU),
but that needs to x86 CPU subclasses and properties in place so
we could remove/isolate legacy stuff to legacy hook.
Did you hit any particular problem with current code?
>
> Jan
>
next prev parent reply other threads:[~2013-07-30 12:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-30 11:00 [Qemu-devel] Error handling in cpu_x86_create Jan Kiszka
2013-07-30 12:21 ` Igor Mammedov [this message]
2013-08-02 15:39 ` Jan Kiszka
2013-08-02 17:22 ` [Qemu-devel] [PATCH for-1.6] target-i386: Fix X86CPU error handling Andreas Färber
2013-08-05 12:06 ` Andreas Färber
2013-08-05 12:09 ` Jan Kiszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130730142143.10a5734d@nial.usersys.redhat.com \
--to=imammedo@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).