git: 73da0265c29c - main - locks: Use %p to print uintptr_t values

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 14 Nov 2024 14:58:21 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=73da0265c29c79641dab3e6b98452bd5afca01fb

commit 73da0265c29c79641dab3e6b98452bd5afca01fb
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-11-14 14:57:14 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-11-14 14:57:56 +0000

    locks: Use %p to print uintptr_t values
    
    Pointers are not the same shape as sizes on CHERI architectures.  Cast
    to void * and print with %p instead.
    
    Obtained from:  CheriBSD
    Sponsored by:   AFRL, DARPA
    Differential Revision:  https://reviews.freebsd.org/D47342
---
 sys/kern/kern_mutex.c  | 2 +-
 sys/kern/kern_rwlock.c | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index fa043fa7e124..c04412688979 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -1072,7 +1072,7 @@ __mtx_unlock_sleep(volatile uintptr_t *c, uintptr_t v)
 	_mtx_release_lock_quick(m);
 	ts = turnstile_lookup(&m->lock_object);
 	if (__predict_false(ts == NULL)) {
-		panic("got NULL turnstile on mutex %p v %zx", m, v);
+		panic("got NULL turnstile on mutex %p v %p", m, (void *)v);
 	}
 	if (LOCK_LOG_TEST(&m->lock_object, opts))
 		CTR1(KTR_LOCK, "_mtx_unlock_sleep: %p contested", m);
diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c
index c7e377c8f77a..3286fce76d96 100644
--- a/sys/kern/kern_rwlock.c
+++ b/sys/kern/kern_rwlock.c
@@ -843,8 +843,8 @@ __rw_runlock_hard(struct rwlock *rw, struct thread *td, uintptr_t v
 		 */
 		ts = turnstile_lookup(&rw->lock_object);
 		if (__predict_false(ts == NULL)) {
-			panic("got NULL turnstile on rwlock %p passedv %zx v %zx",
-			    rw, passedv, v);
+			panic("got NULL turnstile on rwlock %p passedv %p v %p",
+			    rw, (void *)passedv, (void *)v);
 		}
 		turnstile_broadcast(ts, queue);
 		turnstile_unpend(ts);
@@ -1288,8 +1288,8 @@ __rw_wunlock_hard(volatile uintptr_t *c, uintptr_t v LOCK_FILE_LINE_ARG_DEF)
 
 	ts = turnstile_lookup(&rw->lock_object);
 	if (__predict_false(ts == NULL)) {
-		panic("got NULL turnstile on rwlock %p passedv %zx v %zx", rw,
-		    passedv, v);
+		panic("got NULL turnstile on rwlock %p passedv %p v %p", rw,
+		    (void *)passedv, (void *)v);
 	}
 	turnstile_broadcast(ts, queue);
 	turnstile_unpend(ts);