[common] ivshmem: fix failure to check ioctl for error result

This commit is contained in:
Geoffrey McRae 2023-11-11 13:34:21 +11:00
parent a3b51220ed
commit 9a53880b9b

View File

@ -119,7 +119,7 @@ bool ivshmemOpenDev(struct IVSHMEM * dev, const char * shmDevice)
{ {
DEBUG_ASSERT(dev); DEBUG_ASSERT(dev);
unsigned int devSize; int devSize;
int devFd; int devFd;
bool hasDMA; bool hasDMA;
@ -139,6 +139,12 @@ bool ivshmemOpenDev(struct IVSHMEM * dev, const char * shmDevice)
// get the device size // get the device size
devSize = ioctl(devFd, KVMFR_DMABUF_GETSIZE, 0); devSize = ioctl(devFd, KVMFR_DMABUF_GETSIZE, 0);
if (devSize < 0)
{
DEBUG_ERROR("Failed to get the device size");
close(devFd);
return false;
}
hasDMA = true; hasDMA = true;
} }
else else