DragonFlyBSD Kernel Audit
DF-0139 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c
--- a/sys/kern/subr_sleepqueue.c
+++ b/sys/kern/subr_sleepqueue.c
@@ -79,8 +79,8 @@
 
 #define SLEEPQ_HSIZE		1024
 #define SLEEPQ_HMASK		(SLEEPQ_HSIZE - 1)
-#define SLEEPQ_HASH(wchan)	((((uintptr_t)(wchan) >> 10) ^ \
-				  ((uintptr_t)(wchan) & SLEEPQ_HMASK)))
+#define SLEEPQ_HASH(wchan)	(((((uintptr_t)(wchan) >> 10) ^ \
+				  ((uintptr_t)(wchan) & SLEEPQ_HMASK))) & SLEEPQ_HMASK)
 
 #define SLEEPQ_LOOKUP(wchan)	&sleepq_chains[SLEEPQ_HASH(wchan)]
 #define SLEEPQ_NRQUEUES		2