Do not cast struct kevent_args or struct freebsd11_kevent_args to

struct g_kevent_args.

On some architectures, e.g. PowerPC, there is additional padding in uap.

Reported and tested by:	andreast
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
kib 2017-06-29 14:40:33 +00:00
parent b5b198b496
commit f855d50bc8

View File

@ -935,8 +935,16 @@ sys_kevent(struct thread *td, struct kevent_args *uap)
.k_copyin = kevent_copyin,
.kevent_size = sizeof(struct kevent),
};
struct g_kevent_args gk_args = {
.fd = uap->fd,
.changelist = uap->changelist,
.nchanges = uap->nchanges,
.eventlist = uap->eventlist,
.nevents = uap->nevents,
.timeout = uap->timeout,
};
return (kern_kevent_generic(td, (struct g_kevent_args *)uap, &k_ops));
return (kern_kevent_generic(td, &gk_args, &k_ops));
}
static int
@ -1107,8 +1115,16 @@ freebsd11_kevent(struct thread *td, struct freebsd11_kevent_args *uap)
.k_copyin = kevent11_copyin,
.kevent_size = sizeof(struct kevent_freebsd11),
};
struct g_kevent_args gk_args = {
.fd = uap->fd,
.changelist = uap->changelist,
.nchanges = uap->nchanges,
.eventlist = uap->eventlist,
.nevents = uap->nevents,
.timeout = uap->timeout,
};
return (kern_kevent_generic(td, (struct g_kevent_args *)uap, &k_ops));
return (kern_kevent_generic(td, &gk_args, &k_ops));
}
#endif