qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] hw/i386/pc: fix possible segment fault for port


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH] hw/i386/pc: fix possible segment fault for port92_write
Date: Fri, 22 Mar 2013 12:20:13 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4

Am 22.03.2013 10:12, schrieb liguang:
> e.g.
> $qemu-system-x86_64 -device port92
> will report segment fault,
> for port92_write try a un-allocated
> assignment for a20_out.
> so check before this assignment.
> 
> Signed-off-by: liguang <address@hidden>
> ---
>  hw/i386/pc.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index ed7d9ba..a0e8ee0 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -440,7 +440,8 @@ static void port92_write(void *opaque, hwaddr addr, 
> uint64_t val,
>  
>      DPRINTF("port92: write 0x%02x\n", val);
>      s->outport = val;
> -    qemu_set_irq(*s->a20_out, (val >> 1) & 1);
> +    if (s->a20_out)
> +        qemu_set_irq(*s->a20_out, (val >> 1) & 1);

Missing braces.

But I think it would be better to proceed with my QOM'ification [1] and
return an Error on realize here since these IRQs don't change while
realized and qdev init doesn't allow to return a textual error.

Andreas

[1] https://github.com/afaerber/qemu-cpu/commits/realize-isa

>      if (val & 1) {
>          qemu_system_reset_request();
>      }
> 


-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



reply via email to

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