nvmf: Fix bug when accessing realloc'd pointer

Caught by the latest scan-build.

Change-Id: I606a30447e5221c86e79accb9a2c1fe76e9eeee0
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/396054
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ben Walker 2018-01-23 14:30:40 -07:00 committed by Daniel Verkamp
parent b232bff575
commit 2bbc59fa79

View File

@ -570,26 +570,20 @@ int
spdk_nvmf_poll_group_resume_subsystem(struct spdk_nvmf_poll_group *group,
struct spdk_nvmf_subsystem *subsystem)
{
struct spdk_nvmf_subsystem_poll_group *sgroup;
int rc;
if (subsystem->id >= group->num_sgroups) {
return -1;
}
sgroup = &group->sgroups[subsystem->id];
if (sgroup == NULL) {
return -1;
}
assert(sgroup->state == SPDK_NVMF_SUBSYSTEM_PAUSED);
assert(group->sgroups[subsystem->id].state == SPDK_NVMF_SUBSYSTEM_PAUSED);
rc = poll_group_update_subsystem(group, subsystem);
if (rc) {
return rc;
}
sgroup->state = SPDK_NVMF_SUBSYSTEM_ACTIVE;
group->sgroups[subsystem->id].state = SPDK_NVMF_SUBSYSTEM_ACTIVE;
return 0;
}