From a7390aa6fcb8593713f2b95735c47cc0da450693 Mon Sep 17 00:00:00 2001 From: Robert Baldyga Date: Wed, 25 Sep 2019 17:22:01 +0200 Subject: [PATCH] Return error on invalid core id Instead of silently allowing for any core_id in order to set core parameter for all cores in cache, check explicitly for special value (OCF_CORE_ID_INVALID) which means that no core has been selected. Signed-off-by: Robert Baldyga --- modules/cas_cache/layer_cache_management.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/cas_cache/layer_cache_management.c b/modules/cas_cache/layer_cache_management.c index 00acaaa..37d2fee 100644 --- a/modules/cas_cache/layer_cache_management.c +++ b/modules/cas_cache/layer_cache_management.c @@ -2021,9 +2021,11 @@ int cache_mngt_set_core_params(struct kcas_set_core_param *info) if (result) return result; - result = get_core_by_id(cache, info->core_id, &core); - if (result && result != -OCF_ERR_CORE_NOT_EXIST) - goto out; + if (info->core_id != OCF_CORE_ID_INVALID) { + result = get_core_by_id(cache, info->core_id, &core); + if (result) + goto out; + } switch (info->param_id) { case core_param_seq_cutoff_threshold: