From b0d4c946572d0120ebbd264bdff328eb6aec9ce6 Mon Sep 17 00:00:00 2001 From: Olivier Certner Date: Mon, 7 Apr 2025 15:15:49 +0200 Subject: [PATCH] kassert: Turn 'poisoned_buf' into a 'void *' This is a step to make usable without the need to explicitly include other headers. 'poisoned_buf' is only used for its value and never subject to pointer arithmetics. Keeping 'caddr_t' would require to include (at least on INVARIANTS). Reviewed by: markj MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49971 --- sys/kern/vfs_bio.c | 2 +- sys/sys/kassert.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 08ba752bcf2..ea66a81b590 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -160,7 +160,7 @@ nbufp(unsigned i) caddr_t __read_mostly unmapped_buf; #ifdef INVARIANTS -caddr_t poisoned_buf = (void *)-1; +void *poisoned_buf = (void *)-1; #endif /* Used below and for softdep flushing threads in ufs/ffs/ffs_softdep.c */ diff --git a/sys/sys/kassert.h b/sys/sys/kassert.h index 7755a241888..a2bc42058d9 100644 --- a/sys/sys/kassert.h +++ b/sys/sys/kassert.h @@ -51,11 +51,11 @@ extern const char *panicstr; /* panic message */ */ #ifdef INVARIANTS -extern caddr_t poisoned_buf; +extern void *poisoned_buf; #define DEBUG_POISON_POINTER_VALUE poisoned_buf #define DEBUG_POISON_POINTER(x) ({ \ - x = (void *)(DEBUG_POISON_POINTER_VALUE); \ + x = (DEBUG_POISON_POINTER_VALUE); \ }) #else