kassert: Turn 'poisoned_buf' into a 'void *'

This is a step to make <sys/kassert.h> 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 <sys/kassert.h> to include
<sys/types.h> (at least on INVARIANTS).

Reviewed by:    markj
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49971
This commit is contained in:
Olivier Certner 2025-04-07 15:15:49 +02:00
parent a4df0830d7
commit b0d4c94657
No known key found for this signature in database
GPG key ID: 8CA13040971E2627
2 changed files with 3 additions and 3 deletions

View file

@ -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 */

View file

@ -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