diff options
| author | Aymeric Wibo <obiwac@FreeBSD.org> | 2026-05-22 09:58:57 +0000 |
|---|---|---|
| committer | Aymeric Wibo <obiwac@FreeBSD.org> | 2026-05-22 10:01:07 +0000 |
| commit | f814650aaf788323b3d485d96996fce6cd7b2d7f (patch) | |
| tree | 1f2382a286469dac731f31a4cd683cbf7d678d9d | |
| parent | 28d85db46b484589e2ee74cf4b270db066821de1 (diff) | |
power: Fix stype name lengths
When updating the names of the sleep types in 95b4436e989d ("power:
Rename sleep types"), I forgot to update the lengths of the buffers they
went into.
Reported by: mhorne
Fixes: 95b4436e989d ("power: Rename sleep types")
Sponsored by: The FreeBSD Foundation
| -rw-r--r-- | sys/dev/acpica/acpi.c | 2 | ||||
| -rw-r--r-- | sys/kern/subr_power.c | 2 | ||||
| -rw-r--r-- | sys/sys/power.h | 5 |
3 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index ec1f002150c1..8be94db73729 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -4609,7 +4609,7 @@ acpi_sleep_state_sysctl(SYSCTL_HANDLER_ARGS) static int acpi_stype_sysctl(SYSCTL_HANDLER_ARGS) { - char name[10]; + char name[POWER_STYPE_NAME_LEN]; int err; int sstate; enum power_stype new_stype, old_stype; diff --git a/sys/kern/subr_power.c b/sys/kern/subr_power.c index ffd91db83e96..1cfa6e5c77dd 100644 --- a/sys/kern/subr_power.c +++ b/sys/kern/subr_power.c @@ -145,7 +145,7 @@ sysctl_supported_stypes(SYSCTL_HANDLER_ARGS) static int power_sysctl_stype(SYSCTL_HANDLER_ARGS) { - char name[10]; + char name[POWER_STYPE_NAME_LEN]; int err; enum power_stype new_stype, old_stype; diff --git a/sys/sys/power.h b/sys/sys/power.h index a1497d1a6524..b2d49781d359 100644 --- a/sys/sys/power.h +++ b/sys/sys/power.h @@ -85,7 +85,10 @@ enum power_stype { POWER_STYPE_UNKNOWN, }; -static const char * const power_stype_names[POWER_STYPE_COUNT] = { +/* XXX NUL terminator is included in this number */ +#define POWER_STYPE_NAME_LEN 16 + +static const char power_stype_names[POWER_STYPE_COUNT][POWER_STYPE_NAME_LEN] = { [POWER_STYPE_AWAKE] = "awake", [POWER_STYPE_STANDBY] = "standby", [POWER_STYPE_FW_SUSPEND] = "fw_suspend", |
