diff options
author | Thanos Makatos <thanos.makatos@nutanix.com> | 2021-03-29 17:34:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-29 17:34:34 +0100 |
commit | 0ae00cbb9edcc3879b1276cd61479d668a7f1ec9 (patch) | |
tree | 74e104df767b5c6ab62b478e3a52b944e92ed01d /lib/irq.c | |
parent | b60e47f9271a400ba68fe10465107950990eff78 (diff) | |
download | libvfio-user-0ae00cbb9edcc3879b1276cd61479d668a7f1ec9.zip libvfio-user-0ae00cbb9edcc3879b1276cd61479d668a7f1ec9.tar.gz libvfio-user-0ae00cbb9edcc3879b1276cd61479d668a7f1ec9.tar.bz2 |
don't access invalid array index (#405)
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Reviewed-by: John Levon <john.levon@nutanix.com>
Diffstat (limited to 'lib/irq.c')
-rw-r--r-- | lib/irq.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -102,18 +102,18 @@ irqs_disable(vfu_ctx_t *vfu_ctx, uint32_t index, uint32_t start, uint32_t count) assert(index < VFU_DEV_NUM_IRQS); assert(start + count <= vfu_ctx->irq_count[index]); - vfu_log(vfu_ctx, LOG_DEBUG, "disabling IRQ type %s range [%u-%u)", - vfio_irq_idx_to_str(index), start, start + count); - if (count == 0) { count = vfu_ctx->irq_count[index]; } + vfu_log(vfu_ctx, LOG_DEBUG, "disabling IRQ type %s range [%u-%u)", + vfio_irq_idx_to_str(index), start, start + count); + switch (index) { case VFIO_PCI_INTX_IRQ_INDEX: case VFIO_PCI_MSI_IRQ_INDEX: case VFIO_PCI_MSIX_IRQ_INDEX: - efds = vfu_ctx->irqs[index].efds; + efds = vfu_ctx->irqs->efds; break; case VFIO_PCI_ERR_IRQ_INDEX: efds = &vfu_ctx->irqs->err_efd; |