From 3886da5a93cf99e230802a741651fd31e8982370 Mon Sep 17 00:00:00 2001 From: mmacy Date: Sat, 19 May 2018 05:14:05 +0000 Subject: [PATCH] capsicum: propagate const correctness --- sys/kern/kern_descrip.c | 6 +++--- sys/kern/sys_capability.c | 8 ++++---- sys/sys/capsicum.h | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 5a2594ea303..f8172cdab1f 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -2625,9 +2625,9 @@ fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, struct file **fpp, seq_t *seqp) { #ifdef CAPABILITIES - struct filedescent *fde; + const struct filedescent *fde; #endif - struct fdescenttbl *fdt; + const struct fdescenttbl *fdt; struct file *fp; u_int count; #ifdef CAPABILITIES @@ -2673,7 +2673,7 @@ fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, * table before this fd was closed, so it possible that * there is a stale fp pointer in cached version. */ - fdt = *(struct fdescenttbl * volatile *)&(fdp->fd_files); + fdt = *(const struct fdescenttbl * const volatile *)&(fdp->fd_files); continue; } /* diff --git a/sys/kern/sys_capability.c b/sys/kern/sys_capability.c index 68dab46ee89..643f6bfa8a4 100644 --- a/sys/kern/sys_capability.c +++ b/sys/kern/sys_capability.c @@ -183,7 +183,7 @@ cap_check(const cap_rights_t *havep, const cap_rights_t *needp) * Convert capability rights into VM access flags. */ u_char -cap_rights_to_vmprot(cap_rights_t *havep) +cap_rights_to_vmprot(const cap_rights_t *havep) { u_char maxprot; @@ -204,14 +204,14 @@ cap_rights_to_vmprot(cap_rights_t *havep) * this one file. */ -cap_rights_t * -cap_rights_fde(struct filedescent *fdep) +const cap_rights_t * +cap_rights_fde(const struct filedescent *fdep) { return (&fdep->fde_rights); } -cap_rights_t * +const cap_rights_t * cap_rights(struct filedesc *fdp, int fd) { diff --git a/sys/sys/capsicum.h b/sys/sys/capsicum.h index 80b5e98e33f..9985dc39a66 100644 --- a/sys/sys/capsicum.h +++ b/sys/sys/capsicum.h @@ -444,14 +444,14 @@ int cap_check(const cap_rights_t *havep, const cap_rights_t *needp); /* * Convert capability rights into VM access flags. */ -u_char cap_rights_to_vmprot(cap_rights_t *havep); +u_char cap_rights_to_vmprot(const cap_rights_t *havep); /* * For the purposes of procstat(1) and similar tools, allow kern_descrip.c to * extract the rights from a capability. */ -cap_rights_t *cap_rights_fde(struct filedescent *fde); -cap_rights_t *cap_rights(struct filedesc *fdp, int fd); +const cap_rights_t *cap_rights_fde(const struct filedescent *fde); +const cap_rights_t *cap_rights(struct filedesc *fdp, int fd); int cap_ioctl_check(struct filedesc *fdp, int fd, u_long cmd); int cap_fcntl_check_fde(struct filedescent *fde, int cmd); -- 2.45.2