cxgbe/tom: Fix bad signed/unsigned mixup in the stid allocator. This

fixes a panic when allocating a mixture of IPv6 and IPv4 stids.

MFC after:	1 week
This commit is contained in:
np 2013-06-08 07:23:26 +00:00
parent ea7394f077
commit e9cf267187
2 changed files with 3 additions and 3 deletions

View File

@ -59,8 +59,8 @@ struct listen_ctx;
struct stid_region {
TAILQ_ENTRY(stid_region) link;
int used; /* # of stids used by this region */
int free; /* # of contiguous stids free right after this region */
u_int used; /* # of stids used by this region */
u_int free; /* # of contiguous stids free right after this region */
};
/*

View File

@ -125,7 +125,7 @@ alloc_stid(struct adapter *sc, struct listen_ctx *lctx, int isipv6)
TAILQ_FOREACH(s, &t->stids, link) {
stid += s->used + s->free;
f = stid & mask;
if (n <= s->free - f) {
if (s->free >= n + f) {
stid -= n + f;
s->free -= n + f;
TAILQ_INSERT_AFTER(&t->stids, s, sr, link);