summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
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/amd64
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/amd64')
-rw-r--r--sys/arch/amd64/amd64/mem.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/arch/amd64/amd64/mem.c b/sys/arch/amd64/amd64/mem.c
index 53db257d2fa..b64c0e9d2bc 100644
--- a/sys/arch/amd64/amd64/mem.c
+++ b/sys/arch/amd64/amd64/mem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mem.c,v 1.37 2024/10/28 10:18:02 mvs Exp $ */
+/* $OpenBSD: mem.c,v 1.38 2024/11/18 08:42:53 mvs Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1982, 1986, 1990, 1993
@@ -85,7 +85,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);