All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: arei.gonglei@huawei.com, qemu-devel@nongnu.org
Cc: weidong.huang@huawei.com, mst@redhat.com, blauwirbel@gmail.com,
	kraxel@redhat.com, pbonzini@redhat.com, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH v2] cirrus_vga: adding sanity check for vram size
Date: Fri, 09 May 2014 15:15:06 +0400	[thread overview]
Message-ID: <536CB8BA.6060405@msgid.tls.msk.ru> (raw)
In-Reply-To: <1399633496-2192-1-git-send-email-arei.gonglei@huawei.com>

09.05.2014 15:04, arei.gonglei@huawei.com wrote:
> From: Gonglei <arei.gonglei@huawei.com>
> 
> when configure a invalid vram size for cirrus card, such as less
> 2 MB, which will crash qemu. Follow the real hardware, the cirrus
> card has 4 MB video memory. Also for backward compatibility, accept
> 8 MB and 16 MB vram size.
> 
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
> v2: fix checkpatch fails.
>   "WARNING: suspect code indent for conditional statements (5, 9)"
>   maybe not a real warning.
> 
>  hw/display/cirrus_vga.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
> index d1afc76..399a2ef 100644
> --- a/hw/display/cirrus_vga.c
> +++ b/hw/display/cirrus_vga.c
> @@ -2959,6 +2959,14 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev)
>       PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);
>       int16_t device_id = pc->device_id;
>  
> +     /* follow real hardware, cirrus card emulated has 4 MB video memory.
> +       Also accept 8 MB/16 MB for backward compatibility. */
> +     if (s->vga.vram_size_mb != 4 || s->vga.vram_size_mb != 8 ||
> +         s->vga.vram_size_mb != 16) {

This condition will always be true, because a number can't be equal
to 3 _different_ numbers at the same time.

Thanks,

/mjt

  reply	other threads:[~2014-05-09 11:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-09 11:04 [Qemu-devel] [PATCH v2] cirrus_vga: adding sanity check for vram size arei.gonglei
2014-05-09 11:15 ` Michael Tokarev [this message]
2014-05-12  6:39   ` Gonglei (Arei)
2014-05-09 11:39 ` Andreas Färber
2014-05-12  6:46   ` Gonglei (Arei)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=536CB8BA.6060405@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=afaerber@suse.de \
    --cc=arei.gonglei@huawei.com \
    --cc=blauwirbel@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=weidong.huang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.