diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2018-03-01 12:32:31 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2018-03-01 12:32:31 +0000 |
commit | 8cb340c613ee3e626b070e0429c589f8a60ac657 (patch) | |
tree | ef5ef3faa1440f356079abb224ddadd2004bb4c4 | |
parent | 2963d78204b4bb4eb5a6b6cb3035f3c1548fbbc8 (diff) | |
parent | 78d8c99e297eba32897d8a5bdaa005670549d6f7 (diff) |
Merge remote-tracking branch 'remotes/famz/tags/staging-pull-request' into staging
Block patches 2018-03-01
Coverity fixes for nvme://
# gpg: Signature made Thu 01 Mar 2018 07:24:24 GMT
# gpg: using RSA key CA35624C6A9171C6
# gpg: Good signature from "Fam Zheng <famz@redhat.com>"
# Primary key fingerprint: 5003 7CB7 9706 0F76 F021 AD56 CA35 624C 6A91 71C6
* remotes/famz/tags/staging-pull-request:
block/nvme: fix Coverity reports
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | block/nvme.c | 10 | ||||
-rw-r--r-- | util/vfio-helpers.c | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/block/nvme.c b/block/nvme.c index 10bffbbf2f..75078022f6 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -645,7 +645,7 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace, aio_set_event_notifier(bdrv_get_aio_context(bs), &s->irq_notifier, false, nvme_handle_event, nvme_poll_cb); - nvme_identify(bs, namespace, errp); + nvme_identify(bs, namespace, &local_err); if (local_err) { error_propagate(errp, local_err); ret = -EIO; @@ -666,8 +666,12 @@ fail_queue: nvme_free_queue_pair(bs, s->queues[0]); fail: g_free(s->queues); - qemu_vfio_pci_unmap_bar(s->vfio, 0, (void *)s->regs, 0, NVME_BAR_SIZE); - qemu_vfio_close(s->vfio); + if (s->regs) { + qemu_vfio_pci_unmap_bar(s->vfio, 0, (void *)s->regs, 0, NVME_BAR_SIZE); + } + if (s->vfio) { + qemu_vfio_close(s->vfio); + } event_notifier_cleanup(&s->irq_notifier); return ret; } diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c index f478b68400..006674c916 100644 --- a/util/vfio-helpers.c +++ b/util/vfio-helpers.c @@ -104,7 +104,7 @@ static char *sysfs_find_group_file(const char *device, Error **errp) char *path = NULL; sysfs_link = g_strdup_printf("/sys/bus/pci/devices/%s/iommu_group", device); - sysfs_group = g_malloc(PATH_MAX); + sysfs_group = g_malloc0(PATH_MAX); if (readlink(sysfs_link, sysfs_group, PATH_MAX - 1) == -1) { error_setg_errno(errp, errno, "Failed to find iommu group sysfs path"); goto out; |