In ndis_convert_res(), initialize the head of our temporary list

before calling BUS_GET_RESOURCE_LIST(). Previously, the list head would
only be initialized if BUS_GET_RESOURCE_LIST() succeeded; it needs to
be initialized unconditionally so that the list cleanup code won't
trip over potential stack garbage.
This commit is contained in:
Bill Paul 2004-04-07 17:02:55 +00:00
parent c2b37819e4
commit 7b764c37e4

View File

@ -777,6 +777,8 @@ ndis_convert_res(arg)
block = &sc->ndis_block;
dev = sc->ndis_dev;
SLIST_INIT(&brl_rev);
rl = malloc(sizeof(ndis_resource_list) +
(sizeof(cm_partial_resource_desc) * (sc->ndis_rescnt - 1)),
M_DEVBUF, M_NOWAIT|M_ZERO);
@ -805,7 +807,6 @@ ndis_convert_res(arg)
* in order to fix this, we have to create our own
* temporary list with the entries in reverse order.
*/
SLIST_INIT(&brl_rev);
SLIST_FOREACH(brle, brl, link) {
n = malloc(sizeof(struct resource_list_entry),
M_TEMP, M_NOWAIT);