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:
parent
b232bff575
commit
2bbc59fa79
@ -570,26 +570,20 @@ int
|
|||||||
spdk_nvmf_poll_group_resume_subsystem(struct spdk_nvmf_poll_group *group,
|
spdk_nvmf_poll_group_resume_subsystem(struct spdk_nvmf_poll_group *group,
|
||||||
struct spdk_nvmf_subsystem *subsystem)
|
struct spdk_nvmf_subsystem *subsystem)
|
||||||
{
|
{
|
||||||
struct spdk_nvmf_subsystem_poll_group *sgroup;
|
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (subsystem->id >= group->num_sgroups) {
|
if (subsystem->id >= group->num_sgroups) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sgroup = &group->sgroups[subsystem->id];
|
assert(group->sgroups[subsystem->id].state == SPDK_NVMF_SUBSYSTEM_PAUSED);
|
||||||
if (sgroup == NULL) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(sgroup->state == SPDK_NVMF_SUBSYSTEM_PAUSED);
|
|
||||||
|
|
||||||
rc = poll_group_update_subsystem(group, subsystem);
|
rc = poll_group_update_subsystem(group, subsystem);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
sgroup->state = SPDK_NVMF_SUBSYSTEM_ACTIVE;
|
group->sgroups[subsystem->id].state = SPDK_NVMF_SUBSYSTEM_ACTIVE;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user