From 0c7272a66c633b0b11c0b81c0f3552201d083b3a Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Sun, 3 Sep 2017 19:22:06 +0100 Subject: [PATCH] anv: fix off by one in array check MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit `anv_formats[ARRAY_SIZE(anv_formats)]` is already one too far. Spotted by Coverity. CovID: 1417259 Fixes: 242211933a0682696170 "anv/formats: Nicely handle unknown VkFormat enums" Cc: Jason Ekstrand Signed-off-by: Eric Engestrom Reviewed-by: Jason Ekstrand Reviewed-by: Samuel Iglesias Gonsálvez --- src/intel/vulkan/anv_formats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c index c23b143cac2..eead1aa7909 100644 --- a/src/intel/vulkan/anv_formats.c +++ b/src/intel/vulkan/anv_formats.c @@ -253,7 +253,7 @@ static const struct anv_format anv_formats[] = { static bool format_supported(VkFormat vk_format) { - if (vk_format > ARRAY_SIZE(anv_formats)) + if (vk_format >= ARRAY_SIZE(anv_formats)) return false; return anv_formats[vk_format].isl_format != ISL_FORMAT_UNSUPPORTED; -- 2.30.2