Merge pull request #105 from mmichal10/coverity-fallout
Coverity fallout
This commit is contained in:
commit
b9de71126b
@ -882,6 +882,10 @@ static int adjust_column_widths(struct view_t *this,
|
|||||||
|
|
||||||
for (i = 0 ; i != w ; ++i) {
|
for (i = 0 ; i != w ; ++i) {
|
||||||
int this_width = vector_get(&prv->col_w, i);
|
int this_width = vector_get(&prv->col_w, i);
|
||||||
|
/*
|
||||||
|
* This condition is exactly the same as in above loop, where
|
||||||
|
* above_avg_cols is incremented. So there is no risk of division by 0.
|
||||||
|
*/
|
||||||
if (this_width > avg_width) {
|
if (this_width > avg_width) {
|
||||||
int reduce_by = excess_width / above_avg_cols;
|
int reduce_by = excess_width / above_avg_cols;
|
||||||
vector_set(&prv->col_w, i, this_width - reduce_by);
|
vector_set(&prv->col_w, i, this_width - reduce_by);
|
||||||
|
@ -314,7 +314,7 @@ static int _cas_ctx_logger_print(ocf_logger_t logger, ocf_logger_lvl_t lvl,
|
|||||||
[log_debug] = KERN_DEBUG,
|
[log_debug] = KERN_DEBUG,
|
||||||
};
|
};
|
||||||
char *format;
|
char *format;
|
||||||
if (((unsigned)lvl) >= sizeof(level))
|
if (((unsigned)lvl) >= sizeof(level)/sizeof(level[0]))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
format = kasprintf(GFP_ATOMIC, "%s%s", level[lvl], fmt);
|
format = kasprintf(GFP_ATOMIC, "%s%s", level[lvl], fmt);
|
||||||
|
@ -1060,7 +1060,7 @@ int cache_mngt_prepare_cache_cfg(struct ocf_mngt_cache_config *cfg,
|
|||||||
memset(device_cfg, 0, sizeof(*device_cfg));
|
memset(device_cfg, 0, sizeof(*device_cfg));
|
||||||
memset(atomic_params, 0, sizeof(*atomic_params));
|
memset(atomic_params, 0, sizeof(*atomic_params));
|
||||||
|
|
||||||
strncpy(cfg->name, cache_name, OCF_CACHE_NAME_SIZE);
|
strncpy(cfg->name, cache_name, OCF_CACHE_NAME_SIZE - 1);
|
||||||
cfg->cache_mode = cmd->caching_mode;
|
cfg->cache_mode = cmd->caching_mode;
|
||||||
cfg->cache_line_size = cmd->line_size;
|
cfg->cache_line_size = cmd->line_size;
|
||||||
cfg->eviction_policy = cmd->eviction_policy;
|
cfg->eviction_policy = cmd->eviction_policy;
|
||||||
|
@ -861,7 +861,7 @@ static int _cas_upgrade_restore_conf_main(struct cas_properties *cache_props,
|
|||||||
if (cache_mode >= ocf_cache_mode_max)
|
if (cache_mode >= ocf_cache_mode_max)
|
||||||
cache_mode = ocf_cache_mode_default;
|
cache_mode = ocf_cache_mode_default;
|
||||||
|
|
||||||
strncpy(cfg.name, cache_name, OCF_CACHE_NAME_SIZE);
|
strncpy(cfg.name, cache_name, OCF_CACHE_NAME_SIZE - 1);
|
||||||
cfg.cache_mode = cache_mode;
|
cfg.cache_mode = cache_mode;
|
||||||
/* cfg.eviction_policy = TODO */
|
/* cfg.eviction_policy = TODO */
|
||||||
cfg.cache_line_size = cache_line_size;
|
cfg.cache_line_size = cache_line_size;
|
||||||
|
@ -365,7 +365,6 @@ error_after_buffer_allocation:
|
|||||||
|
|
||||||
void cas_properties_print(struct cas_properties *props)
|
void cas_properties_print(struct cas_properties *props)
|
||||||
{
|
{
|
||||||
int result = 0;
|
|
||||||
struct list_head *curr;
|
struct list_head *curr;
|
||||||
struct _cas_property *entry;
|
struct _cas_property *entry;
|
||||||
char *abc;
|
char *abc;
|
||||||
@ -387,8 +386,9 @@ void cas_properties_print(struct cas_properties *props)
|
|||||||
case cas_property_uint:
|
case cas_property_uint:
|
||||||
printk(", uint, ");
|
printk(", uint, ");
|
||||||
printk("Value: %llu ", entry->value_uint);
|
printk("Value: %llu ", entry->value_uint);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
result = -EINVAL;
|
printk("Invalid type!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printk("\n");
|
printk("\n");
|
||||||
|
@ -96,17 +96,8 @@ struct kcas_stop_cache {
|
|||||||
struct kcas_set_cache_state {
|
struct kcas_set_cache_state {
|
||||||
uint16_t cache_id; /**< id of cache for which state should be set */
|
uint16_t cache_id; /**< id of cache for which state should be set */
|
||||||
|
|
||||||
/**
|
|
||||||
* caching mode for new cache instance
|
|
||||||
* valid choices are:
|
|
||||||
* * WRITE_THROUGH
|
|
||||||
* * WRITE_BACK
|
|
||||||
* * WRITE_AROUND
|
|
||||||
* * PASS_THROUGH
|
|
||||||
*/
|
|
||||||
ocf_cache_mode_t caching_mode;
|
ocf_cache_mode_t caching_mode;
|
||||||
|
|
||||||
|
|
||||||
uint8_t flush_data; /**< should data be flushed? */
|
uint8_t flush_data; /**< should data be flushed? */
|
||||||
|
|
||||||
int ext_err_code;
|
int ext_err_code;
|
||||||
|
Loading…
Reference in New Issue
Block a user