qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/block/nvme: Verify msix_vector_use() returned value
@ 2020-06-02 15:57 Philippe Mathieu-Daudé
  2020-06-03  9:04 ` Kevin Wolf
  0 siblings, 1 reply; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-06-02 15:57 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, qemu-block, Klaus Jensen, Max Reitz, Klaus Jensen,
	Keith Busch, Philippe Mathieu-Daudé

msix_vector_use() returns -EINVAL on error. Assert it won't.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Notes taken while reviewing:
https://www.mail-archive.com/qemu-block@nongnu.org/msg66831.html
Based-on: <20200514044611.734782-1-its@irrelevant.dk>
---
 hw/block/nvme.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 0cb54d902d..5fee563e99 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -613,6 +613,10 @@ static uint16_t nvme_del_cq(NvmeCtrl *n, NvmeCmd *cmd)
 static void nvme_init_cq(NvmeCQueue *cq, NvmeCtrl *n, uint64_t dma_addr,
     uint16_t cqid, uint16_t vector, uint16_t size, uint16_t irq_enabled)
 {
+    int ret;
+
+    ret = msix_vector_use(&n->parent_obj, vector);
+    assert(ret == 0);
     cq->ctrl = n;
     cq->cqid = cqid;
     cq->size = size;
@@ -623,7 +627,6 @@ static void nvme_init_cq(NvmeCQueue *cq, NvmeCtrl *n, uint64_t dma_addr,
     cq->head = cq->tail = 0;
     QTAILQ_INIT(&cq->req_list);
     QTAILQ_INIT(&cq->sq_list);
-    msix_vector_use(&n->parent_obj, cq->vector);
     n->cq[cqid] = cq;
     cq->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, nvme_post_cqes, cq);
 }
-- 
2.21.3



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hw/block/nvme: Verify msix_vector_use() returned value
  2020-06-02 15:57 [PATCH] hw/block/nvme: Verify msix_vector_use() returned value Philippe Mathieu-Daudé
@ 2020-06-03  9:04 ` Kevin Wolf
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Wolf @ 2020-06-03  9:04 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-block, Klaus Jensen, qemu-devel, Max Reitz, Klaus Jensen,
	Keith Busch

Am 02.06.2020 um 17:57 hat Philippe Mathieu-Daudé geschrieben:
> msix_vector_use() returns -EINVAL on error. Assert it won't.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> Notes taken while reviewing:
> https://www.mail-archive.com/qemu-block@nongnu.org/msg66831.html
> Based-on: <20200514044611.734782-1-its@irrelevant.dk>

Thanks, applied to the block branch.

Kevin



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-03  9:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02 15:57 [PATCH] hw/block/nvme: Verify msix_vector_use() returned value Philippe Mathieu-Daudé
2020-06-03  9:04 ` Kevin Wolf

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).