Merge pull request #272 from imjfckm/fix-pp-validation

Add PP type validation
This commit is contained in:
Kamil Łepek 2019-09-18 17:30:23 +02:00 committed by GitHub
commit 7131178e71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,6 +63,9 @@ ocf_error_t ocf_promotion_set_policy(ocf_promotion_policy_t policy,
ocf_cache_t cache = policy->owner; ocf_cache_t cache = policy->owner;
ocf_promotion_t prev_policy; ocf_promotion_t prev_policy;
if (type >= ocf_promotion_max)
return -OCF_ERR_INVAL;
prev_policy = cache->conf_meta->promotion_policy_type; prev_policy = cache->conf_meta->promotion_policy_type;
if (ocf_promotion_policies[prev_policy].deinit) if (ocf_promotion_policies[prev_policy].deinit)