Merge pull request #14 from mmichal10/add-nullchecks

Add nullchecks
This commit is contained in:
Adam Rutkowski 2019-04-19 06:04:30 -04:00 committed by GitHub
commit f6e65598f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 4 deletions

View File

@ -1232,9 +1232,15 @@ int cache_mng_init_instance(struct ocf_mngt_cache_config *cfg,
}
if (cmd) {
ocf_volume_t cache_obj = ocf_cache_get_volume(cache);
struct bd_object *bd_cache_obj = bd_object(cache_obj);
struct block_device *bdev = bd_cache_obj->btm_bd;
ocf_volume_t cache_obj;
struct bd_object *bd_cache_obj;
struct block_device *bdev;
cache_obj = ocf_cache_get_volume(cache);
BUG_ON(!cache_obj);
bd_cache_obj = bd_object(cache_obj);
bdev = bd_cache_obj->btm_bd;
/* If we deal with whole device, reread partitions */
if (bdev->bd_contains == bdev)
@ -1641,6 +1647,7 @@ int cache_mng_get_info(struct kcas_cache_info *info)
if (info->info.attached) {
uuid = ocf_cache_get_uuid(cache);
BUG_ON(!uuid);
strlcpy(info->cache_path_name, uuid->data,
min(sizeof(info->cache_path_name), uuid->size));

View File

@ -543,6 +543,8 @@ void _blockdev_set_exported_object_flush_fua(ocf_core_t core)
struct request_queue *core_q, *exp_q, *cache_q;
bool flush, fua;
BUG_ON(!cache_vol);
bd_core_vol = bd_object(core_vol);
bd_cache_vol = bd_object(cache_vol);
@ -624,6 +626,8 @@ static int _blockdev_set_geometry(struct casdsk_disk *dsk, void *private)
cache = ocf_core_get_cache(core);
core_vol = ocf_core_get_volume(core);
cache_vol = ocf_cache_get_volume(cache);
BUG_ON(!cache_vol);
bd_cache_vol = bd_object(cache_vol);
path = ocf_volume_get_uuid(core_vol)->data;

2
ocf

@ -1 +1 @@
Subproject commit 0b098ddb80757b9d4118904fa6bc8f445f991bb1
Subproject commit 9f927de841e82d07fda63c5ad3536620b536f5e0