qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH arm-devs v1 1/1] char/cadence_uart: Fix reset fo


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH arm-devs v1 1/1] char/cadence_uart: Fix reset for unattached instances
Date: Tue, 25 Jun 2013 18:16:02 +0100

On 7 June 2013 05:02,  <address@hidden> wrote:
> From: Peter Crosthwaite <address@hidden>
>
> commit 1db8b5efe0c2b5000e50691eea61264a615f43de introduced an issue
> where QEMU would segfault if you have an unattached Cadence UART.
>
> Fix by guarding the flush-on-reset logic on there being a qemu_chr
> attachment.
>
> Reported-by: Soren Brinkmann <address@hidden>
> Signed-off-by: Peter Crosthwaite <address@hidden>
> ---
>
>  hw/char/cadence_uart.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
> index c2a7834..29827d2 100644
> --- a/hw/char/cadence_uart.c
> +++ b/hw/char/cadence_uart.c
> @@ -157,7 +157,9 @@ static void uart_rx_reset(UartState *s)
>  {
>      s->rx_wpos = 0;
>      s->rx_count = 0;
> -    qemu_chr_accept_input(s->chr);
> +    if (s->chr) {
> +        qemu_chr_accept_input(s->chr);
> +    }

There seem to be a lot of references to s->chr in this device:
is this really the only one which needs a guard against NULL?

thanks
-- PMM



reply via email to

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