From: David Gibson <david@gibson.dropbear.id.au>
To: agraf@suse.de
Cc: michael@ellerman.id.au, qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/5] pseries: Check we have a chardev in spapr_vty_init()
Date: Mon, 14 Nov 2011 14:18:59 +1100 [thread overview]
Message-ID: <1321240741-23055-4-git-send-email-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <1321240741-23055-1-git-send-email-david@gibson.dropbear.id.au>
From: Michael Ellerman <michael@ellerman.id.au>
If qemu is run like:
qemu-system-ppc64 -nodefaults -device spapr-vty
We end up in spapr_vty_init() with dev->chardev == NULL. Currently
that leads to a segfault because we unconditionally call
qemu_chr_add_handlers().
Although we could make that call conditional, I think a spapr-vty
without a chardev is basically useless so fail the init. This is
similar to what the serial code does for example.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
hw/spapr_vty.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/hw/spapr_vty.c b/hw/spapr_vty.c
index a9d4b03..f4f3ee3 100644
--- a/hw/spapr_vty.c
+++ b/hw/spapr_vty.c
@@ -58,6 +58,11 @@ static int spapr_vty_init(VIOsPAPRDevice *sdev)
{
VIOsPAPRVTYDevice *dev = (VIOsPAPRVTYDevice *)sdev;
+ if (!dev->chardev) {
+ fprintf(stderr, "spapr-vty: Can't create vty without a chardev!\n");
+ exit(1);
+ }
+
qemu_chr_add_handlers(dev->chardev, vty_can_receive,
vty_receive, NULL, dev);
--
1.7.7.1
next prev parent reply other threads:[~2011-11-14 3:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-14 3:18 [Qemu-devel] [0/5] Assorted small pseries bug fixes David Gibson
2011-11-14 3:18 ` [Qemu-devel] [PATCH 1/5] pseries: Correct RAM size check for SLOF David Gibson
2011-11-14 3:18 ` [Qemu-devel] [PATCH 2/5] pseries: Fix buggy spapr_vio_find_by_reg() David Gibson
2011-11-14 3:18 ` David Gibson [this message]
2011-11-14 3:19 ` [Qemu-devel] [PATCH 4/5] pseries: Default reg for vty should be SPAPR_VTY_BASE_ADDRESS David Gibson
2011-11-14 3:19 ` [Qemu-devel] [PATCH 5/5] pseries: Allow kernel's early debug output to work David Gibson
2011-11-15 23:28 ` [Qemu-devel] [0/5] Assorted small pseries bug fixes Alexander Graf
2011-11-16 1:01 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2011-11-18 13:23 ` [Qemu-devel] " Alexander Graf
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=1321240741-23055-4-git-send-email-david@gibson.dropbear.id.au \
--to=david@gibson.dropbear.id.au \
--cc=agraf@suse.de \
--cc=michael@ellerman.id.au \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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).