From f7cc3d414c5298b14bbb921f0bdd077e45cbe678 Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Fri, 18 Oct 2019 17:28:04 -0400 Subject: [PATCH] Fix cas_vfree 1. cas_vfree implementation is now properly selected based on kernel version 2. cas_vfree semantics now accepts NULL pionter as a valid input Signed-off-by: Adam Rutkowski --- modules/cas_cache/utils/utils_gc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/cas_cache/utils/utils_gc.c b/modules/cas_cache/utils/utils_gc.c index d3f7208..8b069ae 100644 --- a/modules/cas_cache/utils/utils_gc.c +++ b/modules/cas_cache/utils/utils_gc.c @@ -3,10 +3,12 @@ * SPDX-License-Identifier: BSD-3-Clause-Clear */ +#include "cas_cache.h" #include "utils_gc.h" #include #if defined (CAS_GARBAGE_COLLECTOR) + struct cas_vfree_item { struct llist_head list; struct work_struct ws; @@ -35,6 +37,9 @@ void cas_vfree(const void *addr) { struct cas_vfree_item *item = this_cpu_ptr(&cas_vfree_item); + if (!addr) + return; + atomic_inc(&freed); if (llist_add((struct llist_node *)addr, &item->list))