summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorGreg Steuck <gnezdo@cvs.openbsd.org>2022-01-25 04:04:42 +0000
committerGreg Steuck <gnezdo@cvs.openbsd.org>2022-01-25 04:04:42 +0000
commitc06ea86d3e9b1473fa4399cf3e4a6d797e641e21 (patch)
tree1c06afb7bb6adbe3839d789872f4d70a36a09d62 /sys/arch/amd64
parent37f5b35710e48314d1b0f73843edddd08030977b (diff)
Capture a repeated pattern into sysctl_securelevel_int function
A few variables in the kernel are only writeable before securelevel is raised. It makes sense to handle them with less code. OK sthen@ bluhm@
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/amd64/machdep.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index 326f1c10253..08a20bf76ed 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.275 2021/10/06 15:46:03 claudio Exp $ */
+/* $OpenBSD: machdep.c,v 1.276 2022/01/25 04:04:40 gnezdo Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@@ -513,12 +513,8 @@ cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
case CPU_CPUVENDOR:
return (sysctl_rdstring(oldp, oldlenp, newp, cpu_vendor));
case CPU_KBDRESET:
- if (securelevel > 0)
- return (sysctl_rdint(oldp, oldlenp, newp,
- kbd_reset));
- else
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &kbd_reset));
+ return (sysctl_securelevel_int(oldp, oldlenp, newp, newlen,
+ &kbd_reset));
case CPU_ALLOWAPERTURE:
if (namelen != 1)
return (ENOTDIR); /* overloaded */