From f6e5c84fb6c266521d0f9a41a32048a4be797107 Mon Sep 17 00:00:00 2001 From: kib Date: Fri, 11 Aug 2017 11:38:04 +0000 Subject: [PATCH] MFC r322059: Fix off by one in calculation of the number of buckets for the pc addresses. Approved by: re (marius) git-svn-id: svn://svn.freebsd.org/base/stable/10@322399 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- usr.sbin/pmcstat/pmcpl_gprof.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/pmcstat/pmcpl_gprof.c b/usr.sbin/pmcstat/pmcpl_gprof.c index 5fc9b41ef..d1d1dd4f9 100644 --- a/usr.sbin/pmcstat/pmcpl_gprof.c +++ b/usr.sbin/pmcstat/pmcpl_gprof.c @@ -464,8 +464,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 */ + pgf->pgf_nbuckets = howmany(image->pi_end - image->pi_start, + FUNCTION_ALIGNMENT); /* see */ pgf->pgf_ndatabytes = sizeof(struct gmonhdr) + pgf->pgf_nbuckets * hc_sz; pgf->pgf_nsamples = 0; -- 2.42.0