[PATCH 1/6] plugins/cache: Fixed a bug with destroying FIFO metadata

Mahmoud Mandour posted 6 patches 2 months, 1 week ago
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, Alexandre Iooss <erdnaxe@crans.org>, Mahmoud Mandour <ma.mandourr@gmail.com>

[PATCH 1/6] plugins/cache: Fixed a bug with destroying FIFO metadata

Posted by Mahmoud Mandour 2 months, 1 week ago
This manifests itself when associativity degree is greater than the
number of sets and FIFO is used, otherwise it's also a memory leak
whenever FIFO was used.

Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>
---
 contrib/plugins/cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/plugins/cache.c b/contrib/plugins/cache.c
index bf0d2f6097..4a71602639 100644
--- a/contrib/plugins/cache.c
+++ b/contrib/plugins/cache.c
@@ -200,7 +200,7 @@ static void fifo_destroy(Cache *cache)
 {
     int i;
 
-    for (i = 0; i < cache->assoc; i++) {
+    for (i = 0; i < cache->num_sets; i++) {
         g_queue_free(cache->sets[i].fifo_queue);
     }
 }
-- 
2.25.1


Re: [PATCH 1/6] plugins/cache: Fixed a bug with destroying FIFO metadata

Posted by Alex Bennée 2 months, 1 week ago
Mahmoud Mandour <ma.mandourr@gmail.com> writes:

> This manifests itself when associativity degree is greater than the
> number of sets and FIFO is used, otherwise it's also a memory leak
> whenever FIFO was used.
>
> Signed-off-by: Mahmoud Mandour <ma.mandourr@gmail.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

> ---
>  contrib/plugins/cache.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/contrib/plugins/cache.c b/contrib/plugins/cache.c
> index bf0d2f6097..4a71602639 100644
> --- a/contrib/plugins/cache.c
> +++ b/contrib/plugins/cache.c
> @@ -200,7 +200,7 @@ static void fifo_destroy(Cache *cache)
>  {
>      int i;
>  
> -    for (i = 0; i < cache->assoc; i++) {
> +    for (i = 0; i < cache->num_sets; i++) {
>          g_queue_free(cache->sets[i].fifo_queue);
>      }
>  }


-- 
Alex Bennée