nvmf: Fix bug when resizing sgroups array

Change-Id: I366b941a60d1fb00951591e7f631a65e8a449904
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/392566
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Ben Walker 2017-12-20 13:48:33 -07:00
parent fd0770fecb
commit 1545c8eb5e

View File

@ -433,13 +433,14 @@ spdk_nvmf_poll_group_add_subsystem(struct spdk_nvmf_poll_group *group,
return -ENOMEM;
}
group->sgroups = buf;
/* Zero out the newly allocated memory */
memset(&group->sgroups[group->num_sgroups],
0,
(subsystem->id + 1 - group->num_sgroups) * sizeof(struct spdk_io_channel *));
(subsystem->id + 1 - group->num_sgroups) * sizeof(struct spdk_nvmf_subsystem_poll_group));
group->num_sgroups = subsystem->id + 1;
group->sgroups = buf;
}
sgroup = &group->sgroups[subsystem->id];