mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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. */
|
* shouldn't try to remove the device. */
|
||||||
g_autofree char *vfiogroup =
|
g_autofree char *vfiogroup =
|
||||||
virMediatedDeviceGetIOMMUGroupDev(def->caps->data.mdev.uuid);
|
virMediatedDeviceGetIOMMUGroupDev(def->caps->data.mdev.uuid);
|
||||||
VIR_AUTOCLOSE fd = open(vfiogroup, O_RDONLY);
|
VIR_AUTOCLOSE fd = -1;
|
||||||
g_autofree char *errmsg = NULL;
|
g_autofree char *errmsg = NULL;
|
||||||
|
|
||||||
|
if (!vfiogroup)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
fd = open(vfiogroup, O_RDONLY);
|
||||||
|
|
||||||
if (fd < 0 && errno == EBUSY) {
|
if (fd < 0 && errno == EBUSY) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unable to destroy '%s': device in use"),
|
_("Unable to destroy '%s': device in use"),
|
||||||
|
Loading…
Reference in New Issue
Block a user