From 979124928c4132659f34a1dc7f4ef539c956d955 Mon Sep 17 00:00:00 2001 From: Oki Minabe Date: Fri, 18 Feb 2022 00:08:32 +0900 Subject: [PATCH] fix array index range checking of gat[] in gran_alloc(). --- mm/mm_gran/mm_granalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/mm_gran/mm_granalloc.c b/mm/mm_gran/mm_granalloc.c index 79ebdb0130..88264311a2 100644 --- a/mm/mm_gran/mm_granalloc.c +++ b/mm/mm_gran/mm_granalloc.c @@ -113,7 +113,7 @@ FAR void *gran_alloc(GRAN_HANDLE handle, size_t size) /* Get the next entry from the GAT to support a 64 bit shift */ - if (granidx < priv->ngranules) + if (granidx + 32 < priv->ngranules) { next = priv->gat[gatidx + 1]; }