Fix off by one in calculation of the number of buckets for the pc

addresses.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D11864
This commit is contained in:
Konstantin Belousov 2017-08-04 18:02:54 +00:00
parent 9990efd2e2
commit e28f262a86
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=322059

View File

@ -468,8 +468,8 @@ pmcpl_gmon_process(struct pmcstat_process *pp, struct pmcstat_pmcrecord *pmcr,
image, pmcid);
pgf->pgf_pmcid = pmcid;
assert(image->pi_end > image->pi_start);
pgf->pgf_nbuckets = (image->pi_end - image->pi_start) /
FUNCTION_ALIGNMENT; /* see <machine/profile.h> */
pgf->pgf_nbuckets = howmany(image->pi_end - image->pi_start,
FUNCTION_ALIGNMENT); /* see <machine/profile.h> */
pgf->pgf_ndatabytes = sizeof(struct gmonhdr) +
pgf->pgf_nbuckets * hc_sz;
pgf->pgf_nsamples = 0;