Merge pull request #698 from mmichal10/secure-fixes
fixes for Coverity static analysis findings
This commit is contained in:
commit
99608c9a30
@ -63,10 +63,12 @@ static int _ocf_uuid_set(const struct ocf_volume_uuid *uuid,
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
if (uuid->size < sizeof(muuid->data)) {
|
||||
result = env_memset(muuid->data + uuid->size,
|
||||
sizeof(muuid->data) - uuid->size, 0);
|
||||
if (result)
|
||||
return result;
|
||||
}
|
||||
|
||||
muuid->size = uuid->size;
|
||||
|
||||
|
@ -44,7 +44,7 @@ int ocf_mngt_core_pool_add(ocf_ctx_t ctx, ocf_uuid_t uuid, uint8_t type)
|
||||
|
||||
result = ocf_volume_open(volume, NULL);
|
||||
if (result) {
|
||||
ocf_volume_deinit(volume);
|
||||
ocf_volume_destroy(volume);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -664,9 +664,6 @@ void ocf_mngt_cache_flush(ocf_cache_t cache,
|
||||
|
||||
OCF_CHECK_NULL(cache);
|
||||
|
||||
if (ocf_cache_is_standby(cache))
|
||||
OCF_CMPL_RET(cache, priv, -OCF_ERR_CACHE_STANDBY);
|
||||
|
||||
if (ocf_cache_is_standby(cache)) {
|
||||
ocf_cache_log(cache, log_err, "Cannot flush cache - cache is standby\n");
|
||||
OCF_CMPL_RET(cache, priv, -OCF_ERR_CACHE_STANDBY);
|
||||
|
@ -263,8 +263,10 @@ void ocf_volume_submit_io(struct ocf_io *io)
|
||||
|
||||
ENV_BUG_ON(!volume->type->properties->ops.submit_io);
|
||||
|
||||
if (!volume->opened)
|
||||
if (!volume->opened) {
|
||||
io->end(io, -OCF_ERR_IO);
|
||||
return;
|
||||
}
|
||||
|
||||
volume->type->properties->ops.submit_io(io);
|
||||
}
|
||||
@ -275,8 +277,10 @@ void ocf_volume_submit_flush(struct ocf_io *io)
|
||||
|
||||
ENV_BUG_ON(!volume->type->properties->ops.submit_flush);
|
||||
|
||||
if (!volume->opened)
|
||||
if (!volume->opened) {
|
||||
io->end(io, -OCF_ERR_IO);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!volume->type->properties->ops.submit_flush) {
|
||||
ocf_io_end(io, 0);
|
||||
@ -290,8 +294,10 @@ void ocf_volume_submit_discard(struct ocf_io *io)
|
||||
{
|
||||
ocf_volume_t volume = ocf_io_get_volume(io);
|
||||
|
||||
if (!volume->opened)
|
||||
if (!volume->opened) {
|
||||
io->end(io, -OCF_ERR_IO);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!volume->type->properties->ops.submit_discard) {
|
||||
ocf_io_end(io, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user