diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index a84a478e4e9b..42ca1efda41f 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -2337,7 +2337,7 @@ fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, u_int count; #ifdef CAPABILITIES seq_t seq; - cap_rights_t *haverights; + cap_rights_t haverights; int error; #endif @@ -2356,7 +2356,7 @@ fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, #ifdef CAPABILITIES seq = seq_read(fd_seq(fdt, fd)); fde = &fdt->fdt_ofiles[fd]; - haverights = cap_rights_fde(fde); + haverights = *cap_rights_fde(fde); fp = fde->fde_file; if (!seq_consistent(fd_seq(fdt, fd), seq)) { cpu_spinwait(); @@ -2369,7 +2369,7 @@ fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, return (EBADF); #ifdef CAPABILITIES if (needrightsp != NULL) { - error = cap_check(haverights, needrightsp); + error = cap_check(&haverights, needrightsp); if (error != 0) return (error); } @@ -2505,7 +2505,7 @@ fget_mmap(struct thread *td, int fd, cap_rights_t *rightsp, u_char *maxprotp, */ if (maxprotp != NULL) *maxprotp = cap_rights_to_vmprot(cap_rights(fdp, fd)); - if (!fd_modified(td->td_proc->p_fd, fd, seq)) + if (!fd_modified(fdp, fd, seq)) break; fdrop(*fpp, td); }