Merge pull request #267 from imjfckm/pp-validation-at-start

Add validation of PP for cache start config
This commit is contained in:
Michal Rakowski 2019-09-18 10:53:26 +02:00 committed by GitHub
commit ecb3b25a33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1593,6 +1593,11 @@ static int _ocf_mngt_cache_validate_cfg(struct ocf_mngt_cache_config *cfg)
return -OCF_ERR_INVAL; return -OCF_ERR_INVAL;
} }
if (cfg->promotion_policy >= ocf_promotion_max ||
cfg->promotion_policy < 0 ) {
return -OCF_ERR_INVAL;
}
if (!ocf_cache_line_size_is_valid(cfg->cache_line_size)) if (!ocf_cache_line_size_is_valid(cfg->cache_line_size))
return -OCF_ERR_INVALID_CACHE_LINE_SIZE; return -OCF_ERR_INVALID_CACHE_LINE_SIZE;