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
ae17fd849b
commit
fd5f08e3e8
@ -1229,7 +1229,7 @@ kqueue_expand(struct kqueue *kq, struct filterops *fops, uintptr_t ident,
|
||||
size = kq->kq_knlistsize;
|
||||
while (size <= fd)
|
||||
size += KQEXTENT;
|
||||
list = malloc(size * sizeof list, M_KQUEUE, mflag);
|
||||
list = malloc(size * sizeof(*list), M_KQUEUE, mflag);
|
||||
if (list == NULL)
|
||||
return ENOMEM;
|
||||
KQ_LOCK(kq);
|
||||
@ -1239,13 +1239,13 @@ kqueue_expand(struct kqueue *kq, struct filterops *fops, uintptr_t ident,
|
||||
} else {
|
||||
if (kq->kq_knlist != NULL) {
|
||||
bcopy(kq->kq_knlist, list,
|
||||
kq->kq_knlistsize * sizeof list);
|
||||
kq->kq_knlistsize * sizeof(*list));
|
||||
free(kq->kq_knlist, M_KQUEUE);
|
||||
kq->kq_knlist = NULL;
|
||||
}
|
||||
bzero((caddr_t)list +
|
||||
kq->kq_knlistsize * sizeof list,
|
||||
(size - kq->kq_knlistsize) * sizeof list);
|
||||
kq->kq_knlistsize * sizeof(*list),
|
||||
(size - kq->kq_knlistsize) * sizeof(*list));
|
||||
kq->kq_knlistsize = size;
|
||||
kq->kq_knlist = list;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user