summaryrefslogtreecommitdiff
path: root/sys/kern/kern_sched.c
diff options
context:
space:
mode:
authorgnezdo <gnezdo@cvs.openbsd.org>2021-01-09 20:57:47 +0000
committergnezdo <gnezdo@cvs.openbsd.org>2021-01-09 20:57:47 +0000
commit1d924db67f7b1813fa7e0b815e177bd886a7bb6f (patch)
tree34a328d5259b1f087788a05739822795aba1fdc8 /sys/kern/kern_sched.c
parent13b40d161ba7e6b47b27b7e4c9034ebb49a11864 (diff)
Use sysctl_int_bounded in sysctl_hwsmt
Prefer error reporting is to silent clipping. OK millert@
Diffstat (limited to 'sys/kern/kern_sched.c')
-rw-r--r--sys/kern/kern_sched.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c
index eab78f74c60..24b4faa1fe2 100644
--- a/sys/kern/kern_sched.c
+++ b/sys/kern/kern_sched.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sched.c,v 1.67 2020/06/11 00:00:01 dlg Exp $ */
+/* $OpenBSD: kern_sched.c,v 1.68 2021/01/09 20:57:46 gnezdo Exp $ */
/*
* Copyright (c) 2007, 2008 Artur Grabowski <art@openbsd.org>
*
@@ -861,13 +861,9 @@ sysctl_hwsmt(void *oldp, size_t *oldlenp, void *newp, size_t newlen)
int err, newsmt;
newsmt = sched_smt;
- err = sysctl_int(oldp, oldlenp, newp, newlen, &newsmt);
+ err = sysctl_int_bounded(oldp, oldlenp, newp, newlen, &newsmt, 0, 1);
if (err)
return err;
- if (newsmt > 1)
- newsmt = 1;
- if (newsmt < 0)
- newsmt = 0;
if (newsmt == sched_smt)
return 0;