[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [for-2.0 1/2] hw/arm/highbank: Don't segfault on unknow
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] [for-2.0 1/2] hw/arm/highbank: Don't segfault on unknown CPU names |
Date: |
Thu, 03 Apr 2014 17:48:09 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 |
Am 03.04.2014 15:56, schrieb Peter Maydell:
> If the user passes an unknown CPU name via the '-cpu' option, exit
> with an error message rather than segfaulting.
>
> Signed-off-by: Peter Maydell <address@hidden>
> ---
> hw/arm/highbank.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
> index f66d57b..03545aa 100644
> --- a/hw/arm/highbank.c
> +++ b/hw/arm/highbank.c
> @@ -233,6 +233,11 @@ static void calxeda_init(QEMUMachineInitArgs *args, enum
> cxmachines machine)
> ARMCPU *cpu;
> Error *err = NULL;
>
> + if (!oc) {
> + fprintf(stderr, "Unable to find CPU definition\n");
Old habits die hard... error_report() please.
Otherwise looks good.
One side effect of the cpu_arm_init() inlining here is that it didn't
get the properties support for -cpu, I note.
Regards,
Andreas
> + exit(1);
> + }
> +
> cpu = ARM_CPU(object_new(object_class_get_name(oc)));
>
> object_property_set_int(OBJECT(cpu), MPCORE_PERIPHBASE, "reset-cbar",
>
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg