> +int vfio_get_device(VFIOGroup *group, const char *name, > + VFIODevice *vbasedev) > +{ > + struct vfio_device_info dev_info = { .argsz = sizeof(dev_info) }; > + struct vfio_region_info reg_info = { .argsz = sizeof(reg_info) }; > + struct vfio_irq_info irq_info = { .argsz = sizeof(irq_info) }; > + int ret; > + > + ret = ioctl(group->fd, VFIO_GROUP_GET_DEVICE_FD, name); > + if (ret < 0) { Should be: if(ret) { instead of: if (ret < 0) {
The ioctl can, and sometimes does, return positive values in case of errors. This should also be fixed in vfio_container_do_ioctl()