rpctls_impl.c: Use a direct cast to uintptr_t instead of __DECONST

This fixes the build on CHERI architectures where the compiler warns
about a direct cast between uint64_t and const void * inside of
__DECONST.  However, GCC would also complain about this on 32-bit
kernels due to uint64_t not being the same size as a pointer.  Also,
a direct cast to uintptr_t to right-size the cookie value is more
direct than using __DECONST given that there is no "const" pointer
involved in the expression.

Reviewed by:	brooks, glebius
Obtained from:	CheriBSD
Sponsored by:	AFRL, DARPA
Differential Revision:	https://reviews.freebsd.org/D54797
This commit is contained in:
John Baldwin
2026-01-21 11:10:53 -05:00
parent 37de3763b8
commit 5eb1d4eec6
+1 -1
View File
@@ -163,7 +163,7 @@ sys_rpctls_syscall(struct thread *td, struct rpctls_syscall_args *uap)
mtx_lock(&rpctls_lock);
upsp = RB_FIND(upsock_t, &upcall_sockets,
&(struct upsock){
.so = __DECONST(struct socket *, uap->socookie) });
.so = (struct socket *)(uintptr_t)uap->socookie });
if (__predict_true(upsp != NULL)) {
RB_REMOVE(upsock_t, &upcall_sockets, upsp);
/*