diff options
author | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2024-11-18 08:42:54 +0000 |
---|---|---|
committer | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2024-11-18 08:42:54 +0000 |
commit | 1e37ee8eb1ed0f446c83058a058c109b08be4797 (patch) | |
tree | 2fcba2aa8dd1f926cf227feec7402c3914875b35 | |
parent | 85f9fc6ccbc56c4224aba5691ddf913cffa886a7 (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.
-rw-r--r-- | sys/arch/alpha/alpha/mem.c | 4 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/mem.c | 4 | ||||
-rw-r--r-- | sys/arch/arm/arm/mem.c | 4 | ||||
-rw-r--r-- | sys/arch/arm64/arm64/mem.c | 4 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/mem.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/i386/mem.c | 4 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/mem.c | 4 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/mem.c | 4 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/mem.c | 4 | ||||
-rw-r--r-- | sys/arch/powerpc64/powerpc64/mem.c | 4 | ||||
-rw-r--r-- | sys/arch/riscv64/riscv64/mem.c | 4 | ||||
-rw-r--r-- | sys/arch/sh/sh/mem.c | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/mem.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_sysctl.c | 4 |
14 files changed, 28 insertions, 28 deletions
diff --git a/sys/arch/alpha/alpha/mem.c b/sys/arch/alpha/alpha/mem.c index 88b722f2d2f..948d8a26061 100644 --- a/sys/arch/alpha/alpha/mem.c +++ b/sys/arch/alpha/alpha/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.36 2024/10/28 10:18:02 mvs Exp $ */ +/* $OpenBSD: mem.c,v 1.37 2024/11/18 08:42:53 mvs Exp $ */ /* $NetBSD: mem.c,v 1.26 2000/03/29 03:48:20 simonb Exp $ */ /* @@ -77,7 +77,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); 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); diff --git a/sys/arch/arm/arm/mem.c b/sys/arch/arm/arm/mem.c index 25f702810ae..281b8d1142f 100644 --- a/sys/arch/arm/arm/mem.c +++ b/sys/arch/arm/arm/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.25 2024/10/28 10:18:02 mvs Exp $ */ +/* $OpenBSD: mem.c,v 1.26 2024/11/18 08:42:53 mvs Exp $ */ /* $NetBSD: mem.c,v 1.11 2003/10/16 12:02:58 jdolecek Exp $ */ /* @@ -104,7 +104,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); diff --git a/sys/arch/arm64/arm64/mem.c b/sys/arch/arm64/arm64/mem.c index fd0308065a7..faae7f1e2b7 100644 --- a/sys/arch/arm64/arm64/mem.c +++ b/sys/arch/arm64/arm64/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.8 2024/10/28 10:18:02 mvs Exp $ */ +/* $OpenBSD: mem.c,v 1.9 2024/11/18 08:42:53 mvs Exp $ */ /* $NetBSD: mem.c,v 1.11 2003/10/16 12:02:58 jdolecek Exp $ */ /* @@ -108,7 +108,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); diff --git a/sys/arch/hppa/hppa/mem.c b/sys/arch/hppa/hppa/mem.c index 2fc070e76c4..c53bf81a848 100644 --- a/sys/arch/hppa/hppa/mem.c +++ b/sys/arch/hppa/hppa/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.8 2024/10/28 10:18:02 mvs Exp $ */ +/* $OpenBSD: mem.c,v 1.9 2024/11/18 08:42:53 mvs Exp $ */ /* * Copyright (c) 1998-2004 Michael Shalayeff @@ -307,7 +307,7 @@ mmopen(dev_t dev, int flag, int ioflag, 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); 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); diff --git a/sys/arch/m88k/m88k/mem.c b/sys/arch/m88k/m88k/mem.c index 0157fd2a0e1..851b38224b9 100644 --- a/sys/arch/m88k/m88k/mem.c +++ b/sys/arch/m88k/m88k/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.8 2024/10/28 10:18:03 mvs Exp $ */ +/* $OpenBSD: mem.c,v 1.9 2024/11/18 08:42:53 mvs Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -65,7 +65,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); diff --git a/sys/arch/macppc/macppc/mem.c b/sys/arch/macppc/macppc/mem.c index 7e5ce6d1b31..35cc6bc3b8d 100644 --- a/sys/arch/macppc/macppc/mem.c +++ b/sys/arch/macppc/macppc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.30 2024/10/28 10:18:03 mvs Exp $ */ +/* $OpenBSD: mem.c,v 1.31 2024/11/18 08:42:53 mvs Exp $ */ /* $NetBSD: mem.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ /* @@ -197,7 +197,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); diff --git a/sys/arch/mips64/mips64/mem.c b/sys/arch/mips64/mips64/mem.c index 47d49ef0d78..ac7c8712fe2 100644 --- a/sys/arch/mips64/mips64/mem.c +++ b/sys/arch/mips64/mips64/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.26 2024/10/28 10:18:03 mvs Exp $ */ +/* $OpenBSD: mem.c,v 1.27 2024/11/18 08:42:53 mvs Exp $ */ /* $NetBSD: mem.c,v 1.6 1995/04/10 11:55:03 mycroft Exp $ */ /* @@ -78,7 +78,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); diff --git a/sys/arch/powerpc64/powerpc64/mem.c b/sys/arch/powerpc64/powerpc64/mem.c index 3174f3f61c0..d9c0b0a18c8 100644 --- a/sys/arch/powerpc64/powerpc64/mem.c +++ b/sys/arch/powerpc64/powerpc64/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.3 2024/10/28 10:18:03 mvs Exp $ */ +/* $OpenBSD: mem.c,v 1.4 2024/11/18 08:42:53 mvs Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -69,7 +69,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); diff --git a/sys/arch/riscv64/riscv64/mem.c b/sys/arch/riscv64/riscv64/mem.c index cc6d9939dd5..ad18a1e13f6 100644 --- a/sys/arch/riscv64/riscv64/mem.c +++ b/sys/arch/riscv64/riscv64/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.7 2024/10/28 10:18:03 mvs Exp $ */ +/* $OpenBSD: mem.c,v 1.8 2024/11/18 08:42:53 mvs Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -104,7 +104,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); diff --git a/sys/arch/sh/sh/mem.c b/sys/arch/sh/sh/mem.c index 88c15695034..f28c13cfc26 100644 --- a/sys/arch/sh/sh/mem.c +++ b/sys/arch/sh/sh/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.13 2024/10/28 10:18:03 mvs Exp $ */ +/* $OpenBSD: mem.c,v 1.14 2024/11/18 08:42:53 mvs Exp $ */ /* $NetBSD: mem.c,v 1.21 2006/07/23 22:06:07 ad Exp $ */ /* @@ -108,7 +108,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); diff --git a/sys/arch/sparc64/sparc64/mem.c b/sys/arch/sparc64/sparc64/mem.c index 19b8152295d..7effdca0576 100644 --- a/sys/arch/sparc64/sparc64/mem.c +++ b/sys/arch/sparc64/sparc64/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.22 2024/10/28 10:18:03 mvs Exp $ */ +/* $OpenBSD: mem.c,v 1.23 2024/11/18 08:42:53 mvs Exp $ */ /* $NetBSD: mem.c,v 1.18 2001/04/24 04:31:12 thorpej Exp $ */ /* @@ -69,7 +69,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); diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index b45b2b7ca1d..0bc6ab794b4 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.454 2024/11/08 10:24:13 bluhm Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.455 2024/11/18 08:42:53 mvs Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -1173,7 +1173,7 @@ int sysctl_securelevel_int(void *oldp, size_t *oldlenp, void *newp, size_t newlen, int *valp) { - if (atomic_load_int(&securelevel) > 0) + if ((int)atomic_load_int(&securelevel) > 0) return (sysctl_rdint(oldp, oldlenp, newp, *valp)); return (sysctl_int(oldp, oldlenp, newp, newlen, valp)); } |