hyperv/vmbus: Make sure that the sub-channel count is valid.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7865
This commit is contained in:
Sepherosa Ziehau 2016-09-14 06:30:14 +00:00
parent 098ab4a242
commit 67e44048f0

View File

@ -1346,6 +1346,8 @@ vmbus_subchan_get(struct vmbus_channel *pri_chan, int subchan_cnt)
struct vmbus_channel **ret, *chan;
int i;
KASSERT(subchan_cnt > 0, ("invalid sub-channel count %d", subchan_cnt));
ret = malloc(subchan_cnt * sizeof(struct vmbus_channel *), M_TEMP,
M_WAITOK);