qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: arei.gonglei@huawei.com
Cc: weidong.huang@huawei.com, mst@redhat.com, qemu-devel@nongnu.org,
	Blue Swirl <blauwirbel@gmail.com>,
	pbonzini@redhat.com, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH] cirrus_vga: adding sanity check for vram size [checkpatch false positive?]
Date: Fri, 09 May 2014 12:31:10 +0200	[thread overview]
Message-ID: <1399631470.5213.47.camel@nilsson.home.kraxel.org> (raw)
In-Reply-To: <1399630869-920-1-git-send-email-arei.gonglei@huawei.com>

On Fr, 2014-05-09 at 18:21 +0800, 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.

Fails checkpatch:

=== checkpatch complains ===
WARNING: suspect code indent for conditional statements (5, 9)
#12: FILE: hw/display/cirrus_vga.c:2964:
+     if (s->vga.vram_size_mb != 4 || s->vga.vram_size_mb != 8 ||
[...]
+         error_report("Invalid cirrus_vga ram size '%u'\n",
s->vga.vram_size_mb);

WARNING: line over 80 characters
#14: FILE: hw/display/cirrus_vga.c:2966:
+         error_report("Invalid cirrus_vga ram size '%u'\n",
s->vga.vram_size_mb);

total: 0 errors, 2 warnings, 13 lines checked

First warning looks like a false positive though.

MAINTAINERS lists blue swirl as checkpatch maintainer, Cc'ing.
Havn't seen him on the list for quite a while though, is that still
up-to-date?

cheers,
  Gerd

> 
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
> For isa cirrus vga device, its' init function has been droped at
> commit db895a1e6a97e919f9b86d60c969377357b05066. I have no idea how adding
> check on isa_cirrus_vga device. Any ideas? Thanks.
>  
>  hw/display/cirrus_vga.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
> index d1afc76..5fec068 100644
> --- a/hw/display/cirrus_vga.c
> +++ b/hw/display/cirrus_vga.c
> @@ -2959,6 +2959,13 @@ 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) {
> +         error_report("Invalid cirrus_vga ram size '%u'\n", s->vga.vram_size_mb);
> +         return -1;
> +     }
>       /* setup VGA */
>       vga_common_init(&s->vga, OBJECT(dev), true);
>       cirrus_init_common(s, OBJECT(dev), device_id, 1, pci_address_space(dev),

  reply	other threads:[~2014-05-09 10:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-09 10:21 [Qemu-devel] [PATCH] cirrus_vga: adding sanity check for vram size arei.gonglei
2014-05-09 10:31 ` Gerd Hoffmann [this message]
2014-05-09 10:40   ` [Qemu-devel] [PATCH] cirrus_vga: adding sanity check for vram size [checkpatch false positive?] Gonglei (Arei)
2014-05-09 10:54     ` Gerd Hoffmann
2014-05-09 10:59       ` Gonglei (Arei)
2014-05-09 11:53         ` [Qemu-devel] [PATCH] cirrus_vga: adding sanity check for vram size Andreas Färber
2014-05-09 11:18 ` Dr. David Alan Gilbert
2014-05-09 11:50   ` Paolo Bonzini
2014-05-09 11:54   ` Gerd Hoffmann
2014-05-09 12:02     ` Dr. David Alan Gilbert
2014-05-12 17:05     ` Eric Blake
2014-05-12 17:53       ` Andreas Färber
2014-05-12 17:03   ` Eric Blake

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=1399631470.5213.47.camel@nilsson.home.kraxel.org \
    --to=kraxel@redhat.com \
    --cc=afaerber@suse.de \
    --cc=arei.gonglei@huawei.com \
    --cc=blauwirbel@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).