diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 808dc08fe381..3377376f158d 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1758,7 +1758,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) env = getenv("kernelname"); if (env != NULL) - strlcpy(kernelname, env, MAXPATHLEN); + strlcpy(kernelname, env, sizeof(kernelname)); #ifdef XENHVM if (inw(0x10) == 0x49d2) { diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c index 19fec2bb6116..51c57a33c2e3 100644 --- a/sys/ia64/ia64/machdep.c +++ b/sys/ia64/ia64/machdep.c @@ -792,7 +792,7 @@ ia64_init(void) p = getenv("kernelname"); if (p != NULL) { - strlcpy(kernelname, p, MAXPATHLEN); + strlcpy(kernelname, p, sizeof(kernelname)); freeenv(p); } diff --git a/sys/powerpc/aim/machdep.c b/sys/powerpc/aim/machdep.c index 2a4f1c6a70b8..efcfaac0ebe0 100644 --- a/sys/powerpc/aim/machdep.c +++ b/sys/powerpc/aim/machdep.c @@ -540,7 +540,7 @@ powerpc_init(vm_offset_t startkernel, vm_offset_t endkernel, */ env = getenv("kernelname"); if (env != NULL) { - strlcpy(kernelname, env, MAXPATHLEN); + strlcpy(kernelname, env, sizeof(kernelname)); freeenv(env); } diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c index 263a5e39bcb9..86e0af8a7372 100644 --- a/sys/sparc64/sparc64/machdep.c +++ b/sys/sparc64/sparc64/machdep.c @@ -532,7 +532,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec) init_param2(physmem); env = getenv("kernelname"); if (env != NULL) { - strlcpy(kernelname, env, MAXPATHLEN); + strlcpy(kernelname, env, sizeof(kernelname)); freeenv(env); } diff --git a/sys/sun4v/sun4v/machdep.c b/sys/sun4v/sun4v/machdep.c index 8016667f8ec3..9475933ff764 100644 --- a/sys/sun4v/sun4v/machdep.c +++ b/sys/sun4v/sun4v/machdep.c @@ -425,7 +425,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec) env = getenv("kernelname"); if (env != NULL) { - strlcpy(kernelname, env, MAXPATHLEN); + strlcpy(kernelname, env, sizeof(kernelname)); freeenv(env); } diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h index eb00b0dddd07..1a9cb5cd003d 100644 --- a/sys/sys/kernel.h +++ b/sys/sys/kernel.h @@ -55,7 +55,7 @@ /* Global variables for the kernel. */ /* 1.1 */ -extern char kernelname[/*MAXPATHLEN*/]; +extern char kernelname[MAXPATHLEN]; extern int tick; /* usec per tick (1000000 / hz) */ extern int hz; /* system clock's frequency */