From owner-svn-src-all@FreeBSD.ORG Thu Mar 10 22:56:00 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C391B1065676; Thu, 10 Mar 2011 22:56:00 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B06FE8FC15; Thu, 10 Mar 2011 22:56:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2AMu0n5058459; Thu, 10 Mar 2011 22:56:00 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2AMu0ww058452; Thu, 10 Mar 2011 22:56:00 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201103102256.p2AMu0ww058452@svn.freebsd.org> From: Matthew D Fleming Date: Thu, 10 Mar 2011 22:56:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r219468 - in head/sys: amd64/amd64 ia64/ia64 powerpc/aim sparc64/sparc64 sun4v/sun4v sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Mar 2011 22:56:01 -0000 Author: mdf Date: Thu Mar 10 22:56:00 2011 New Revision: 219468 URL: http://svn.freebsd.org/changeset/base/219468 Log: Use MAXPATHLEN rather than the size of an extern array when copying the kernel name. Also consistenly use strlcpy(). Suggested by: Warner Losh Modified: head/sys/amd64/amd64/machdep.c head/sys/ia64/ia64/machdep.c head/sys/powerpc/aim/machdep.c head/sys/sparc64/sparc64/machdep.c head/sys/sun4v/sun4v/machdep.c head/sys/sys/kernel.h Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Thu Mar 10 22:20:11 2011 (r219467) +++ head/sys/amd64/amd64/machdep.c Thu Mar 10 22:56:00 2011 (r219468) @@ -1741,7 +1741,7 @@ hammer_time(u_int64_t modulep, u_int64_t env = getenv("kernelname"); if (env != NULL) - strlcpy(kernelname, env, sizeof(kernelname)); + strlcpy(kernelname, env, MAXPATHLEN); #ifdef XENHVM if (inw(0x10) == 0x49d2) { Modified: head/sys/ia64/ia64/machdep.c ============================================================================== --- head/sys/ia64/ia64/machdep.c Thu Mar 10 22:20:11 2011 (r219467) +++ head/sys/ia64/ia64/machdep.c Thu Mar 10 22:56:00 2011 (r219468) @@ -792,7 +792,7 @@ ia64_init(void) p = getenv("kernelname"); if (p != NULL) { - strncpy(kernelname, p, sizeof(kernelname) - 1); + strlcpy(kernelname, p, MAXPATHLEN); freeenv(p); } Modified: head/sys/powerpc/aim/machdep.c ============================================================================== --- head/sys/powerpc/aim/machdep.c Thu Mar 10 22:20:11 2011 (r219467) +++ head/sys/powerpc/aim/machdep.c Thu Mar 10 22:56:00 2011 (r219468) @@ -540,7 +540,7 @@ powerpc_init(vm_offset_t startkernel, vm */ env = getenv("kernelname"); if (env != NULL) { - strlcpy(kernelname, env, sizeof(kernelname)); + strlcpy(kernelname, env, MAXPATHLEN); freeenv(env); } Modified: head/sys/sparc64/sparc64/machdep.c ============================================================================== --- head/sys/sparc64/sparc64/machdep.c Thu Mar 10 22:20:11 2011 (r219467) +++ head/sys/sparc64/sparc64/machdep.c Thu Mar 10 22:56:00 2011 (r219468) @@ -532,7 +532,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_l init_param2(physmem); env = getenv("kernelname"); if (env != NULL) { - strlcpy(kernelname, env, sizeof(kernelname)); + strlcpy(kernelname, env, MAXPATHLEN); freeenv(env); } Modified: head/sys/sun4v/sun4v/machdep.c ============================================================================== --- head/sys/sun4v/sun4v/machdep.c Thu Mar 10 22:20:11 2011 (r219467) +++ head/sys/sun4v/sun4v/machdep.c Thu Mar 10 22:56:00 2011 (r219468) @@ -425,7 +425,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_l env = getenv("kernelname"); if (env != NULL) { - strlcpy(kernelname, env, sizeof(kernelname)); + strlcpy(kernelname, env, MAXPATHLEN); freeenv(env); } Modified: head/sys/sys/kernel.h ============================================================================== --- head/sys/sys/kernel.h Thu Mar 10 22:20:11 2011 (r219467) +++ head/sys/sys/kernel.h Thu Mar 10 22:56:00 2011 (r219468) @@ -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 */