summaryrefslogtreecommitdiff
path: root/sys/arch/i386
diff options
context:
space:
mode:
authorVitaliy Makkoveev <mvs@cvs.openbsd.org>2024-11-18 08:42:54 +0000
committerVitaliy Makkoveev <mvs@cvs.openbsd.org>2024-11-18 08:42:54 +0000
commit1e37ee8eb1ed0f446c83058a058c109b08be4797 (patch)
tree2fcba2aa8dd1f926cf227feec7402c3914875b35 /sys/arch/i386
parent85f9fc6ccbc56c4224aba5691ddf913cffa886a7 (diff)
Cast atomic_load_int(9) to signed int when loading `securelevel'.
The return value of atomic_load_int(9) is unsigned so needs a cast, otherwise securelevel=-1 gets misrepresented. From Paul Fertser.
Diffstat (limited to 'sys/arch/i386')
-rw-r--r--sys/arch/i386/i386/mem.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/arch/i386/i386/mem.c b/sys/arch/i386/i386/mem.c
index 6d534949240..de7121b5c90 100644
--- a/sys/arch/i386/i386/mem.c
+++ b/sys/arch/i386/i386/mem.c
@@ -1,5 +1,5 @@
/* $NetBSD: mem.c,v 1.31 1996/05/03 19:42:19 christos Exp $ */
-/* $OpenBSD: mem.c,v 1.58 2024/10/28 10:18:03 mvs Exp $ */
+/* $OpenBSD: mem.c,v 1.59 2024/11/18 08:42:53 mvs Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1982, 1986, 1990, 1993
@@ -79,7 +79,7 @@ mmopen(dev_t dev, int flag, int mode, struct proc *p)
switch (minor(dev)) {
case 0:
case 1:
- if (atomic_load_int(&securelevel) <= 0 ||
+ if ((int)atomic_load_int(&securelevel) <= 0 ||
atomic_load_int(&allowkmem))
break;
return (EPERM);