diff options
author | Conrad Meyer <cem@FreeBSD.org> | 2017-07-29 23:31:21 +0000 |
---|---|---|
committer | Conrad Meyer <cem@FreeBSD.org> | 2017-07-29 23:31:21 +0000 |
commit | ca3fec504252bc89e7cafa17f05b99400991fa12 (patch) | |
tree | 3b4497817de73b08f4ed8109d6c87a886a47e706 /sys | |
parent | b9c6d356b240c0553bef80247d918b551da26925 (diff) | |
download | src-ca3fec504252bc89e7cafa17f05b99400991fa12.tar.gz src-ca3fec504252bc89e7cafa17f05b99400991fa12.zip |
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 <sagarwal AT isilon.com>
Sponsored by: Dell EMC Isilon
Notes
Notes:
svn path=/head/; revision=321707
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_linker.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c index a4b2a034af61..06cd3c0a5750 100644 --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -1243,8 +1243,8 @@ kern_kldstat(struct thread *td, int fileid, struct kld_file_stat *stat) /* 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_file_stat *stat) 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); |