diff --git a/shared/source/os_interface/windows/wddm_memory_manager.cpp b/shared/source/os_interface/windows/wddm_memory_manager.cpp index 18667aaf98..d4c19fc5dc 100644 --- a/shared/source/os_interface/windows/wddm_memory_manager.cpp +++ b/shared/source/os_interface/windows/wddm_memory_manager.cpp @@ -811,11 +811,10 @@ bool WddmMemoryManager::isMemoryBudgetExhausted() const { bool WddmMemoryManager::validateAllocation(WddmAllocation *alloc) { if (alloc == nullptr) return false; - auto size = alloc->getUnderlyingBufferSize(); if (alloc->physicalMemoryReservation && !alloc->mappedPhysicalMemoryReservation) { return true; } - if (alloc->getGpuAddress() == 0u || size == 0 || (alloc->getDefaultHandle() == 0 && alloc->fragmentsStorage.fragmentCount == 0)) + if (alloc->getGpuAddress() == 0u || (alloc->getDefaultHandle() == 0 && alloc->fragmentsStorage.fragmentCount == 0)) return false; return true; } diff --git a/shared/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp b/shared/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp index 8c95be4ca5..f0520f00d2 100644 --- a/shared/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp +++ b/shared/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp @@ -3372,6 +3372,17 @@ TEST_F(MockWddmMemoryManagerTest, givenValidateAllocationFunctionWhenItIsCalledW memoryManager.freeGraphicsMemory(wddmAlloc); } +TEST_F(MockWddmMemoryManagerTest, givenValidateAllocationFunctionWhenItIsCalledWithZeroSizedAllocationThenSuccessIsReturned) { + wddm->init(); + MockWddmMemoryManager memoryManager(executionEnvironment); + + auto ptr = reinterpret_cast(0x1234); + WddmAllocation allocation{0, AllocationType::commandBuffer, ptr, castToUint64(ptr), 0, nullptr, MemoryPool::system64KBPages, 0u, 1u}; + allocation.getHandleToModify(0u) = 1; + + EXPECT_TRUE(memoryManager.validateAllocationMock(&allocation)); +} + TEST_F(MockWddmMemoryManagerTest, givenCreateOrReleaseDeviceSpecificMemResourcesWhenCreatingMemoryManagerObjectThenTheseMethodsAreEmpty) { wddm->init(); MockWddmMemoryManager memoryManager(executionEnvironment);