git: 859fcbb91908 - stable/15 - vmem: Fix the gcc build
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 29 Dec 2025 17:07:16 UTC
The branch stable/15 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=859fcbb9190827a62b1410f5f7ddcb87ef28ce6e
commit 859fcbb9190827a62b1410f5f7ddcb87ef28ce6e
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-12-17 20:54:40 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-12-29 14:50:12 +0000
vmem: Fix the gcc build
gcc complains when building libuvmem because the last two operands of ?:
in ORDER2SIZE and SIZE2ORDER have different signs. Add explicit casts
to address this.
Reported by: Jenkins
Reviewed by: alc, kib
MFC after: 1 week
Fixes: 1ecf01065b45 ("libuvmem: usermode port of vmem(9)")
Differential Revision: https://reviews.freebsd.org/D54268
(cherry picked from commit 377e6050c1cb9edce90d2a3caa2833fcc09b8c68)
---
sys/kern/subr_vmem.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/sys/kern/subr_vmem.c b/sys/kern/subr_vmem.c
index afc327c512ce..8b834a2e2a79 100644
--- a/sys/kern/subr_vmem.c
+++ b/sys/kern/subr_vmem.c
@@ -285,10 +285,12 @@ static LIST_HEAD(, vmem) vmem_list = LIST_HEAD_INITIALIZER(vmem_list);
#define VMEM_CROSS_P(addr1, addr2, boundary) \
((((addr1) ^ (addr2)) & -(boundary)) != 0)
-#define ORDER2SIZE(order) ((order) < VMEM_OPTVALUE ? ((order) + 1) : \
- (vmem_size_t)1 << ((order) - (VMEM_OPTVALUE - VMEM_OPTORDER - 1)))
-#define SIZE2ORDER(size) ((size) <= VMEM_OPTVALUE ? ((size) - 1) : \
- (flsl(size) + (VMEM_OPTVALUE - VMEM_OPTORDER - 2)))
+#define ORDER2SIZE(order) ((order) < VMEM_OPTVALUE ? \
+ (vmem_size_t)((order) + 1) : \
+ (vmem_size_t)1 << ((order) - (VMEM_OPTVALUE - VMEM_OPTORDER - 1)))
+#define SIZE2ORDER(size) ((size) <= VMEM_OPTVALUE ? \
+ (int)((size) - 1) : \
+ (flsl(size) + (VMEM_OPTVALUE - VMEM_OPTORDER - 2)))
/*
* Maximum number of boundary tags that may be required to satisfy an