From: Eric Engestrom Date: Sun, 3 Sep 2017 18:22:06 +0000 (+0100) Subject: anv: fix off by one in array check X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0c7272a66c633b0b11c0b81c0f3552201d083b3a;p=mesa.git anv: fix off by one in array check `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 --- 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;