From owner-svn-src-head@freebsd.org Sat Jul 29 23:31:22 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5630BDCD82A; Sat, 29 Jul 2017 23:31:22 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 243638070A; Sat, 29 Jul 2017 23:31:22 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6TNVLv1017764; Sat, 29 Jul 2017 23:31:21 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6TNVLLO017763; Sat, 29 Jul 2017 23:31:21 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201707292331.v6TNVLLO017763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 29 Jul 2017 23:31:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321707 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 321707 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jul 2017 23:31:22 -0000 Author: cem Date: Sat Jul 29 23:31:21 2017 New Revision: 321707 URL: https://svnweb.freebsd.org/changeset/base/321707 Log: kldstat: Use sizeof in place of named constants for sizing No functional change. This is handy for FreeBSD derivatives that want to modify the value of MAXPATHLEN, but not the kld_file_stat ABI. Submitted by: Siddhant Agarwal Sponsored by: Dell EMC Isilon Modified: head/sys/kern/kern_linker.c Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Sat Jul 29 22:25:45 2017 (r321706) +++ head/sys/kern/kern_linker.c Sat Jul 29 23:31:21 2017 (r321707) @@ -1243,8 +1243,8 @@ kern_kldstat(struct thread *td, int fileid, struct kld /* Version 1 fields: */ namelen = strlen(lf->filename) + 1; - if (namelen > MAXPATHLEN) - namelen = MAXPATHLEN; + if (namelen > sizeof(stat->name)) + namelen = sizeof(stat->name); bcopy(lf->filename, &stat->name[0], namelen); stat->refs = lf->refs; stat->id = lf->id; @@ -1252,8 +1252,8 @@ kern_kldstat(struct thread *td, int fileid, struct kld stat->size = lf->size; /* Version 2 fields: */ namelen = strlen(lf->pathname) + 1; - if (namelen > MAXPATHLEN) - namelen = MAXPATHLEN; + if (namelen > sizeof(stat->pathname)) + namelen = sizeof(stat->pathname); bcopy(lf->pathname, &stat->pathname[0], namelen); sx_xunlock(&kld_sx);