Fix uuid comparison in core pool

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga 2021-09-03 17:21:50 +02:00
parent 8015a30348
commit ab034ab53d

View File

@ -74,6 +74,8 @@ ocf_volume_t ocf_mngt_core_pool_lookup(ocf_ctx_t ctx, ocf_uuid_t uuid,
ocf_volume_type_t type) ocf_volume_type_t type)
{ {
ocf_volume_t svolume; ocf_volume_t svolume;
int result;
int cmp;
OCF_CHECK_NULL(ctx); OCF_CHECK_NULL(ctx);
OCF_CHECK_NULL(uuid); OCF_CHECK_NULL(uuid);
@ -81,10 +83,15 @@ ocf_volume_t ocf_mngt_core_pool_lookup(ocf_ctx_t ctx, ocf_uuid_t uuid,
list_for_each_entry(svolume, &ctx->core_pool.core_pool_head, list_for_each_entry(svolume, &ctx->core_pool.core_pool_head,
core_pool_item) { core_pool_item) {
if (svolume->type == type && !env_strncmp(svolume->uuid.data, if (svolume->type != type)
svolume->uuid.size, uuid->data, uuid->size)) { continue;
return svolume;
} result = env_memcmp(svolume->uuid.data, svolume->uuid.size,
uuid->data, uuid->size, &cmp);
if (result || cmp)
continue;
return svolume;
} }
return NULL; return NULL;