Use correct sizeof() object for klist 'list'. Currently, struct klist
contained only SLIST_HEAD as its member, thus sizeof(struct klist) would equal to sizeof(struct klist *), so this change makes the code more correct in terms of semantics, but should be a no-op to compiler at this time. Reported by: MQ <antinvidia at gmail com>
This commit is contained in:
parent
66981e7fec
commit
13dcbd75c1
@ -1229,7 +1229,7 @@ kqueue_expand(struct kqueue *kq, struct filterops *fops, uintptr_t ident,
|
|||||||
size = kq->kq_knlistsize;
|
size = kq->kq_knlistsize;
|
||||||
while (size <= fd)
|
while (size <= fd)
|
||||||
size += KQEXTENT;
|
size += KQEXTENT;
|
||||||
list = malloc(size * sizeof list, M_KQUEUE, mflag);
|
list = malloc(size * sizeof(*list), M_KQUEUE, mflag);
|
||||||
if (list == NULL)
|
if (list == NULL)
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
KQ_LOCK(kq);
|
KQ_LOCK(kq);
|
||||||
@ -1239,13 +1239,13 @@ kqueue_expand(struct kqueue *kq, struct filterops *fops, uintptr_t ident,
|
|||||||
} else {
|
} else {
|
||||||
if (kq->kq_knlist != NULL) {
|
if (kq->kq_knlist != NULL) {
|
||||||
bcopy(kq->kq_knlist, list,
|
bcopy(kq->kq_knlist, list,
|
||||||
kq->kq_knlistsize * sizeof list);
|
kq->kq_knlistsize * sizeof(*list));
|
||||||
free(kq->kq_knlist, M_KQUEUE);
|
free(kq->kq_knlist, M_KQUEUE);
|
||||||
kq->kq_knlist = NULL;
|
kq->kq_knlist = NULL;
|
||||||
}
|
}
|
||||||
bzero((caddr_t)list +
|
bzero((caddr_t)list +
|
||||||
kq->kq_knlistsize * sizeof list,
|
kq->kq_knlistsize * sizeof(*list),
|
||||||
(size - kq->kq_knlistsize) * sizeof list);
|
(size - kq->kq_knlistsize) * sizeof(*list));
|
||||||
kq->kq_knlistsize = size;
|
kq->kq_knlistsize = size;
|
||||||
kq->kq_knlist = list;
|
kq->kq_knlist = list;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user