[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 3/5] pseries: Check we have a chardev in spapr_vty_ini
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PATCH 3/5] pseries: Check we have a chardev in spapr_vty_init() |
Date: |
Mon, 14 Nov 2011 14:18:59 +1100 |
From: Michael Ellerman <address@hidden>
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 <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
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
- [Qemu-ppc] [0/5] Assorted small pseries bug fixes, David Gibson, 2011/11/13
- [Qemu-ppc] [PATCH 1/5] pseries: Correct RAM size check for SLOF, David Gibson, 2011/11/13
- [Qemu-ppc] [PATCH 4/5] pseries: Default reg for vty should be SPAPR_VTY_BASE_ADDRESS, David Gibson, 2011/11/13
- [Qemu-ppc] [PATCH 5/5] pseries: Allow kernel's early debug output to work, David Gibson, 2011/11/13
- [Qemu-ppc] [PATCH 2/5] pseries: Fix buggy spapr_vio_find_by_reg(), David Gibson, 2011/11/13
- [Qemu-ppc] [PATCH 3/5] pseries: Check we have a chardev in spapr_vty_init(),
David Gibson <=
- Re: [Qemu-ppc] [0/5] Assorted small pseries bug fixes, Alexander Graf, 2011/11/15
- Re: [Qemu-ppc] [0/5] Assorted small pseries bug fixes, Alexander Graf, 2011/11/18