diff options
author | Paolo Bonzini | 2018-02-13 02:52:40 +0100 |
---|---|---|
committer | Fam Zheng | 2018-03-01 08:21:46 +0100 |
commit | 78d8c99e297eba32897d8a5bdaa005670549d6f7 (patch) | |
tree | 2bc121978f94a0e4608000cf5f857ec26703b64d /util/vfio-helpers.c | |
parent | Merge remote-tracking branch 'remotes/kraxel/tags/usb-20180227-pull-request' ... (diff) | |
download | qemu-78d8c99e297eba32897d8a5bdaa005670549d6f7.tar.gz qemu-78d8c99e297eba32897d8a5bdaa005670549d6f7.tar.xz qemu-78d8c99e297eba32897d8a5bdaa005670549d6f7.zip |
block/nvme: fix Coverity reports
1) string not null terminated in sysfs_find_group_file
2) NULL pointer dereference and dead local variable in nvme_init.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <20180213015240.9352-1-famz@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Diffstat (limited to 'util/vfio-helpers.c')
-rw-r--r-- | util/vfio-helpers.c | 2 |
1 files changed, 1 insertions, 1 deletions
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; |