Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/sys cpuio.h: Use uint8_t, not bool.
details: https://anonhg.NetBSD.org/src/rev/5ae2726ed237
branches: trunk
changeset: 368413:5ae2726ed237
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Jul 10 09:59:22 2022 +0000
description:
cpuio.h: Use uint8_t, not bool.
In principle bool can only store two values, 0 and 1, but occupies
eight bits of storage (on all NetBSD platforms to my knowledge),
meaning there are 254 other values which might be trap
representations which would be undefined behaviour to use but which
userland can control the bits of.
To placate ubsan, just use uint8_t here instead of bool. No bump or
anything because the ABI is the same: one-byte field with one-byte
alignment.
Reported-by: syzbot+3bc3d6837da151448e87%syzkaller.appspotmail.com@localhost
diffstat:
sys/sys/cpuio.h | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (22 lines):
diff -r b5eba3f7c17e -r 5ae2726ed237 sys/sys/cpuio.h
--- a/sys/sys/cpuio.h Sun Jul 10 08:17:02 2022 +0000
+++ b/sys/sys/cpuio.h Sun Jul 10 09:59:22 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuio.h,v 1.9 2013/01/05 16:36:38 dsl Exp $ */
+/* $NetBSD: cpuio.h,v 1.10 2022/07/10 09:59:22 riastradh Exp $ */
/*-
* Copyright (c) 2007, 2009, 2012 The NetBSD Foundation, Inc.
@@ -47,9 +47,9 @@
*/
typedef struct cpustate {
u_int cs_id; /* matching ci_cpuid */
- bool cs_online; /* running unbound LWPs */
- bool cs_intr; /* fielding interrupts */
- bool cs_unused[2]; /* reserved */
+ uint8_t cs_online; /* running unbound LWPs */
+ uint8_t cs_intr; /* fielding interrupts */
+ uint8_t cs_unused[2]; /* reserved */
int32_t cs_lastmod; /* time of last state change */
char cs_name[16]; /* reserved */
int32_t cs_lastmodhi; /* time of last state change */
Home |
Main Index |
Thread Index |
Old Index