diff options
author | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2021-08-23 19:08:53 +0000 |
---|---|---|
committer | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2021-08-23 19:08:53 +0000 |
commit | a792a0089a61641d7d82b756b693dcdb7babf359 (patch) | |
tree | f13f54ddb781fc634847798f83d92944dd163f6e /src/VBox/HostDrivers/VBoxUSB | |
parent | abc960b1e06eea6400e4e450339732f21db89de3 (diff) | |
download | VirtualBox-svn-a792a0089a61641d7d82b756b693dcdb7babf359.tar.gz |
HostDrivers: More VALID_PTR -> RT_VALID_PTR/AssertPtr.
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@90804 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/HostDrivers/VBoxUSB')
5 files changed, 12 insertions, 14 deletions
diff --git a/src/VBox/HostDrivers/VBoxUSB/USBFilter.cpp b/src/VBox/HostDrivers/VBoxUSB/USBFilter.cpp index b36a8dc562a..b4816b41e79 100644 --- a/src/VBox/HostDrivers/VBoxUSB/USBFilter.cpp +++ b/src/VBox/HostDrivers/VBoxUSB/USBFilter.cpp @@ -307,7 +307,7 @@ static int usbfilterValidateStringPattern(const char *psz) */ USBLIB_DECL(int) USBFilterValidate(PCUSBFILTER pFilter) { - if (!VALID_PTR(pFilter)) + if (!RT_VALID_PTR(pFilter)) return VERR_INVALID_POINTER; if (pFilter->u32Magic != USBFILTER_MAGIC) diff --git a/src/VBox/HostDrivers/VBoxUSB/VBoxUSBFilterMgr.cpp b/src/VBox/HostDrivers/VBoxUSB/VBoxUSBFilterMgr.cpp index 632a81b3862..a417a004870 100644 --- a/src/VBox/HostDrivers/VBoxUSB/VBoxUSBFilterMgr.cpp +++ b/src/VBox/HostDrivers/VBoxUSB/VBoxUSBFilterMgr.cpp @@ -235,7 +235,7 @@ int VBoxUSBFilterAdd(PCUSBFILTER pFilter, VBOXUSBFILTER_CONTEXT Owner, uintptr_t return rc; if (!Owner || Owner == VBOXUSBFILTER_CONTEXT_NIL) return VERR_INVALID_PARAMETER; - if (!VALID_PTR(puId)) + if (!RT_VALID_PTR(puId)) return VERR_INVALID_POINTER; /* diff --git a/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSB-solaris.c b/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSB-solaris.c index becde743c71..a9a32396a08 100644 --- a/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSB-solaris.c +++ b/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSB-solaris.c @@ -1357,13 +1357,13 @@ LOCAL int vboxUsbSolarisProcessIOCtl(int iFunction, void *pvState, int Mode, PVB #define CHECKRET_MIN_SIZE(mnemonic, cbMin) \ do { \ - if (cbData < (cbMin)) \ + if (RT_UNLIKELY(cbData < (cbMin))) \ { \ LogRel((DEVICE_NAME ": vboxUsbSolarisProcessIOCtl: " mnemonic ": cbData=%#zx (%zu) min is %#zx (%zu)\n", \ cbData, cbData, (size_t)(cbMin), (size_t)(cbMin))); \ return VERR_BUFFER_OVERFLOW; \ } \ - if ((cbMin) != 0 && !VALID_PTR(pvBuf)) \ + if (RT_UNLIKELY((cbMin) != 0 && !RT_VALID_PTR(pvBuf))) \ { \ LogRel((DEVICE_NAME ": vboxUsbSolarisProcessIOCtl: " mnemonic ": Invalid pointer %p\n", pvBuf)); \ return VERR_INVALID_PARAMETER; \ diff --git a/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSBMon-solaris.c b/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSBMon-solaris.c index 6c50ef7e5e9..5f9b7d22f45 100644 --- a/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSBMon-solaris.c +++ b/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSBMon-solaris.c @@ -577,7 +577,7 @@ static int VBoxUSBMonSolarisIOCtl(dev_t Dev, int Cmd, intptr_t pArg, int Mode, c return EFAULT; } if (RT_UNLIKELY( ReqWrap.cbData != 0 - && !VALID_PTR(pvBuf))) + && !RT_VALID_PTR(pvBuf))) { RTMemTmpFree(pvBuf); LogRel((DEVICE_NAME ": VBoxUSBMonSolarisIOCtl: pvBuf Invalid pointer %p\n", pvBuf)); @@ -657,13 +657,13 @@ static int vboxUSBMonSolarisProcessIOCtl(int iFunction, void *pvState, void *pvD #define CHECKRET_MIN_SIZE(mnemonic, cbMin) \ do { \ - if (cbData < (cbMin)) \ + if (RT_UNLIKELY(cbData < (cbMin))) \ { \ LogRel(("vboxUSBSolarisProcessIOCtl: " mnemonic ": cbData=%#zx (%zu) min is %#zx (%zu)\n", \ cbData, cbData, (size_t)(cbMin), (size_t)(cbMin))); \ return VERR_BUFFER_OVERFLOW; \ } \ - if ((cbMin) != 0 && !VALID_PTR(pvData)) \ + if (RT_UNLIKELY((cbMin) != 0 && !RT_VALID_PTR(pvData))) \ { \ LogRel(("vboxUSBSolarisProcessIOCtl: " mnemonic ": Invalid pointer %p\n", pvData)); \ return VERR_INVALID_POINTER; \ diff --git a/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.cpp b/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.cpp index 62cad4932cd..53f518b06a9 100644 --- a/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.cpp +++ b/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.cpp @@ -295,10 +295,8 @@ NTSTATUS VBoxUsbMonQueryBusRelations(PDEVICE_OBJECT pDevObj, PFILE_OBJECT pFileO { PDEVICE_RELATIONS pRel = (PDEVICE_RELATIONS)IoStatus.Information; LOG(("pRel = %p", pRel)); - if (VALID_PTR(pRel)) - { + if (RT_VALID_PTR(pRel)) *pDevRelations = pRel; - } else { WARN(("Invalid pointer %p", pRel)); @@ -369,7 +367,7 @@ static NTSTATUS vboxUsbMonHandlePnPIoctl(PDEVICE_OBJECT pDevObj, PIO_STACK_LOCAT if (pIoStatus->Status == STATUS_SUCCESS) { WCHAR *pId = (WCHAR *)pIoStatus->Information; - if (VALID_PTR(pId)) + if (RT_VALID_PTR(pId)) { KIRQL Iqrl = KeGetCurrentIrql(); /* IRQL should be always passive here */ @@ -420,7 +418,7 @@ static NTSTATUS vboxUsbMonHandlePnPIoctl(PDEVICE_OBJECT pDevObj, PIO_STACK_LOCAT #ifdef VBOX_USB_WITH_VERBOSE_LOGGING WCHAR *pTmp; #endif - if (VALID_PTR(pId)) + if (RT_VALID_PTR(pId)) { KIRQL Iqrl = KeGetCurrentIrql(); /* IRQL should be always passive here */ @@ -581,7 +579,7 @@ static NTSTATUS vboxUsbMonHandlePnPIoctl(PDEVICE_OBJECT pDevObj, PIO_STACK_LOCAT { PDEVICE_RELATIONS pRel = (PDEVICE_RELATIONS)pIoStatus->Information; LOG(("pRel = %p", pRel)); - if (VALID_PTR(pRel)) + if (RT_VALID_PTR(pRel)) { for (unsigned i=0;i<pRel->Count;i++) { @@ -614,7 +612,7 @@ static NTSTATUS vboxUsbMonHandlePnPIoctl(PDEVICE_OBJECT pDevObj, PIO_STACK_LOCAT if (pIoStatus->Status == STATUS_SUCCESS) { PDEVICE_CAPABILITIES pCaps = pSl->Parameters.DeviceCapabilities.Capabilities; - if (VALID_PTR(pCaps)) + if (RT_VALID_PTR(pCaps)) { LOG(("Caps.SilentInstall = %d", pCaps->SilentInstall)); LOG(("Caps.UniqueID = %d", pCaps->UniqueID )); |