From ee087540b38c80eb1e7cc5cbf381781c66542abb Mon Sep 17 00:00:00 2001 From: deraadt Date: Sat, 10 Feb 2024 15:28:16 +0000 Subject: [PATCH] On kernels without ucom(4) support, 'sysctl hw.ucomnames' should return the empty string, rather than error. ok krw --- sys/kern/kern_sysctl.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 862efafbf14..91bd12930e3 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.424 2024/01/19 01:43:27 bluhm Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.425 2024/02/10 15:28:16 deraadt Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -771,14 +771,13 @@ hw_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, case HW_ALLOWPOWERDOWN: return (sysctl_securelevel_int(oldp, oldlenp, newp, newlen, &allowpowerdown)); -#if NUCOM > 0 case HW_UCOMNAMES: { - const char *str = sysctl_ucominit(); - if (str == NULL) - return EINVAL; + const char *str = ""; +#if NUCOM > 0 + str = sysctl_ucominit(); +#endif /* NUCOM > 0 */ return (sysctl_rdstring(oldp, oldlenp, newp, str)); } -#endif /* NUCOM > 0 */ #ifdef __HAVE_CPU_TOPOLOGY case HW_SMT: return (sysctl_hwsmt(oldp, oldlenp, newp, newlen)); -- 2.20.1