Pass name for newly initialized cache in array instead of pointer.

Unitl now pointer to local variable was passed to OCF and it's content could be
overwriten after leaving function responsible for preparing cache config.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk
2019-08-20 01:45:21 -04:00
parent ded43cdec6
commit 56cbc6595b
3 changed files with 3 additions and 3 deletions

View File

@@ -1051,7 +1051,7 @@ int cache_mngt_prepare_cache_cfg(struct ocf_mngt_cache_config *cfg,
memset(device_cfg, 0, sizeof(*device_cfg));
memset(atomic_params, 0, sizeof(*atomic_params));
cfg->name = cache_name;
strncpy(cfg->name, cache_name, OCF_CACHE_NAME_SIZE);
cfg->cache_mode = cmd->caching_mode;
cfg->cache_line_size = cmd->line_size;
cfg->eviction_policy = cmd->eviction_policy;

View File

@@ -861,7 +861,7 @@ static int _cas_upgrade_restore_conf_main(struct cas_properties *cache_props,
if (cache_mode >= ocf_cache_mode_max)
cache_mode = ocf_cache_mode_default;
cfg.name = cache_name;
strncpy(cfg.name, cache_name, OCF_CACHE_NAME_SIZE);
cfg.cache_mode = cache_mode;
/* cfg.eviction_policy = TODO */
cfg.cache_line_size = cache_line_size;

2
ocf

Submodule ocf updated: 8ed525ae7f...43e8905456