From c06c3fd82b3f54e4a6192a4fc9f1f37ad5022e7f Mon Sep 17 00:00:00 2001 From: lyndonli Date: Fri, 13 Sep 2024 18:13:29 +0800 Subject: [PATCH] wsl/hsakmt: Fix boundary condition in VaMgr::Alloc Signed-off-by: lyndonli Reviewed by: Shi.Leslie Part-of: --- wddm/va_mgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wddm/va_mgr.cpp b/wddm/va_mgr.cpp index 39fa74c9e1..06777bed59 100644 --- a/wddm/va_mgr.cpp +++ b/wddm/va_mgr.cpp @@ -40,7 +40,7 @@ uint64_t VaMgr::Alloc(uint64_t bytes, uint64_t align, uint64_t addr) { const uint64_t size = frag_it->second.size; // Cannot find free fragment contains the target `addr` - if (bytes > size || addr < base || addr + bytes >= base + size || + if (bytes > size || addr < base || addr + bytes > base + size || !is_free(frag_it->second)) { --frag_it; continue;