From 1aeb11cde1bc610cb23343ab507b1bf3b197b1b4 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Tue, 12 Jul 2022 11:20:10 +0300 Subject: [PATCH] intel: protect against empty invalidate ranges MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's legal for an application to call vkInvalidateMappedMemoryRanges() / vkFlushMappedMemoryRanges() with zero sized ranges. Signed-off-by: Lionel Landwerlin Fixes: b91971c240d3 ("anv: use the right helper to invalidate memory") Cc: mesa-stable Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6852 Reviewed-by: Marcin Ĺšlusarz Part-of: --- src/intel/common/intel_clflush.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/intel/common/intel_clflush.h b/src/intel/common/intel_clflush.h index 7c6aaf8f2df..e1c3728015f 100644 --- a/src/intel/common/intel_clflush.h +++ b/src/intel/common/intel_clflush.h @@ -49,6 +49,9 @@ intel_flush_range(void *start, size_t size) static inline void intel_invalidate_range(void *start, size_t size) { + if (size == 0) + return; + intel_clflush_range(start, size); /* Modern Atom CPUs (Baytrail+) have issues with clflush serialization,