git: b0d4c946572d - main - kassert: Turn 'poisoned_buf' into a 'void *'
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 28 Apr 2025 12:23:40 UTC
The branch main has been updated by olce:
URL: https://cgit.FreeBSD.org/src/commit/?id=b0d4c946572d0120ebbd264bdff328eb6aec9ce6
commit b0d4c946572d0120ebbd264bdff328eb6aec9ce6
Author: Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-04-07 13:15:49 +0000
Commit: Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-04-28 12:19:42 +0000
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
---
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 08ba752bcf29..ea66a81b5903 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 7755a241888f..a2bc42058d93 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