mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
nodedev: handle null return from GetIOMMUGroupDev()
Coverity reported that this function can return NULL, so it should be handled properly. Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
12850ed257
commit
5c4b2bf770
@ -1207,9 +1207,14 @@ nodeDeviceDestroy(virNodeDevicePtr device)
|
||||
* shouldn't try to remove the device. */
|
||||
g_autofree char *vfiogroup =
|
||||
virMediatedDeviceGetIOMMUGroupDev(def->caps->data.mdev.uuid);
|
||||
VIR_AUTOCLOSE fd = open(vfiogroup, O_RDONLY);
|
||||
VIR_AUTOCLOSE fd = -1;
|
||||
g_autofree char *errmsg = NULL;
|
||||
|
||||
if (!vfiogroup)
|
||||
goto cleanup;
|
||||
|
||||
fd = open(vfiogroup, O_RDONLY);
|
||||
|
||||
if (fd < 0 && errno == EBUSY) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unable to destroy '%s': device in use"),
|
||||
|
Loading…
Reference in New Issue
Block a user