All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Cao jin <caoj.fnst@cn.fujitsu.com>
Cc: qemu-devel@nongnu.org, Marcel Apfelbaum <marcel@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/6] msix_init: assert programming error
Date: Thu, 18 Aug 2016 09:14:27 +0200	[thread overview]
Message-ID: <87h9aift0s.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <1471444747-6277-2-git-send-email-caoj.fnst@cn.fujitsu.com> (Cao jin's message of "Wed, 17 Aug 2016 22:39:02 +0800")

Cao jin <caoj.fnst@cn.fujitsu.com> writes:

> CC: Markus Armbruster <armbru@redhat.com>
> CC: Marcel Apfelbaum <marcel@redhat.com>
> CC: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
> ---
>  hw/pci/msix.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/hw/pci/msix.c b/hw/pci/msix.c
> index 0ec1cb1..384a29d 100644
> --- a/hw/pci/msix.c
> +++ b/hw/pci/msix.c
> @@ -253,9 +253,7 @@ int msix_init(struct PCIDevice *dev, unsigned short nentries,
>          return -ENOTSUP;
>      }
>  
> -    if (nentries < 1 || nentries > PCI_MSIX_FLAGS_QSIZE + 1) {
> -        return -EINVAL;
> -    }
> +    assert(nentries >= 1 && nentries <= PCI_MSIX_FLAGS_QSIZE + 1);
>  
>      table_size = nentries * PCI_MSIX_ENTRY_SIZE;
>      pba_size = QEMU_ALIGN_UP(nentries, 64) / 8;
> @@ -266,7 +264,7 @@ int msix_init(struct PCIDevice *dev, unsigned short nentries,
>          table_offset + table_size > memory_region_size(table_bar) ||
>          pba_offset + pba_size > memory_region_size(pba_bar) ||
>          (table_offset | pba_offset) & PCI_MSIX_FLAGS_BIRMASK) {
> -        return -EINVAL;
> +        assert(0);
>      }
>  
>      cap = pci_add_capability(dev, PCI_CAP_ID_MSIX, cap_pos, MSIX_CAP_LENGTH);

Please explain in the commit message why these are programming errors.
If you're unsure how, give it a try in a reply to this message, and
we'll hammer out something together.

  reply	other threads:[~2016-08-18  7:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-17 14:39 [Qemu-devel] [PATCH 0/6] Convert msix_init() to error Cao jin
2016-08-17 14:39 ` [Qemu-devel] [PATCH 1/6] msix_init: assert programming error Cao jin
2016-08-18  7:14   ` Markus Armbruster [this message]
2016-08-18  7:46     ` Cao jin
2016-08-17 14:39 ` [Qemu-devel] [PATCH 2/6] pci: Convert msix_init() to Error and fix callers to check it Cao jin
2016-08-18  7:55   ` Markus Armbruster
2016-08-19  8:11     ` Cao jin
2016-08-17 14:39 ` [Qemu-devel] [PATCH 3/6] e1000e: fix for migration compatibility Cao jin
2016-08-18  5:25   ` Dmitry Fleytman
2016-08-18 10:47   ` Paolo Bonzini
2016-08-18 13:11     ` Cao jin
2016-08-18 13:04       ` Paolo Bonzini
2016-08-18 13:25         ` Cao jin
2016-08-18 13:22           ` Paolo Bonzini
2016-08-17 14:39 ` [Qemu-devel] [PATCH 4/6] e1000e: drop unnecessary funtions Cao jin
2016-08-18  5:23   ` Dmitry Fleytman
2016-08-18  7:38     ` Cao jin
2016-08-17 14:39 ` [Qemu-devel] [PATCH 5/6] megasas: remove unnecessary megasas_use_msix() Cao jin
2016-08-17 14:39 ` [Qemu-devel] [PATCH 6/6] megasas: undo the overwrites of user configuration Cao jin

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=87h9aift0s.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=caoj.fnst@cn.fujitsu.com \
    --cc=marcel@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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.