qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] PowerPC: Avoid segfault in cpu_dump_state


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] PowerPC: Avoid segfault in cpu_dump_state
Date: Mon, 14 May 2012 16:39:21 +0100

On 14 May 2012 15:46, Fabien Chouteau <address@hidden> wrote:
> Quit if no log file is defined.
>
> Signed-off-by: Fabien Chouteau <address@hidden>
> ---
>  target-ppc/translate.c |    4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/target-ppc/translate.c b/target-ppc/translate.c
> index cf59765..f17bd91 100644
> --- a/target-ppc/translate.c
> +++ b/target-ppc/translate.c
> @@ -9319,6 +9319,10 @@ void cpu_dump_state (CPUPPCState *env, FILE *f, 
> fprintf_function cpu_fprintf,
>
>     int i;
>
> +    if (f == NULL) {
> +        return;
> +    }
> +
>     cpu_synchronize_state(env);
>
>     cpu_fprintf(f, "NIP " TARGET_FMT_lx "   LR " TARGET_FMT_lx " CTR "

target-ppc isn't the only one that doesn't check for a NULL f:
perhaps it would be better to say "you can't call this with a
NULL FILE*" and fix whatever is calling it in that way?

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]