Module Name:    src
Committed By:   riastradh
Date:           Fri May  1 01:31:17 UTC 2020

Modified Files:
        src/sys/kern: kern_entropy.c

Log Message:
Fix sense of conditional in previous.

I must have tested (cold ? (void *)1 : curlwp) but then decided,
after testing, to replace cold by !curcpu_available() -- thinking
that would be a safe change to make, except I forgot to either write
the ! or change the sense of the conditional.  OOPS.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/kern/kern_entropy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_entropy.c
diff -u src/sys/kern/kern_entropy.c:1.7 src/sys/kern/kern_entropy.c:1.8
--- src/sys/kern/kern_entropy.c:1.7	Thu Apr 30 20:06:40 2020
+++ src/sys/kern/kern_entropy.c	Fri May  1 01:31:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_entropy.c,v 1.7 2020/04/30 20:06:40 riastradh Exp $	*/
+/*	$NetBSD: kern_entropy.c,v 1.8 2020/05/01 01:31:17 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.7 2020/04/30 20:06:40 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.8 2020/05/01 01:31:17 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -1566,7 +1566,7 @@ rnd_trylock_sources(void)
 
 	if (E->sourcelock)
 		return false;
-	E->sourcelock = (curcpu_available() ? (void *)1 : curlwp);
+	E->sourcelock = (curcpu_available() ? curlwp : (void *)1);
 	return true;
 }
 
@@ -1582,9 +1582,9 @@ rnd_unlock_sources(void)
 
 	KASSERT(E->stage == ENTROPY_COLD || mutex_owned(&E->lock));
 
-	KASSERTMSG(E->sourcelock == (curcpu_available() ? (void *)1 : curlwp),
+	KASSERTMSG(E->sourcelock == (curcpu_available() ? curlwp : (void *)1),
 	    "lwp %p releasing lock held by %p",
-	    (curcpu_available() ? (void *)1 : curlwp), E->sourcelock);
+	    (curcpu_available() ? curlwp : (void *)1), E->sourcelock);
 	E->sourcelock = NULL;
 	if (E->stage >= ENTROPY_WARM)
 		cv_broadcast(&E->cv);
@@ -1600,7 +1600,7 @@ static bool __diagused
 rnd_sources_locked(void)
 {
 
-	return E->sourcelock == (curcpu_available() ? (void *)1 : curlwp);
+	return E->sourcelock == (curcpu_available() ? curlwp : (void *)1);
 }
 
 /*

Reply via email to