svn commit: r343350 - in stable: 11/sys/dev/hwpmc 12/sys/dev/hwpmc

Mark Johnston markj at FreeBSD.org
Wed Jan 23 17:37:00 UTC 2019


Author: markj
Date: Wed Jan 23 17:36:58 2019
New Revision: 343350
URL: https://svnweb.freebsd.org/changeset/base/343350

Log:
  MFC r343265:
  hwpmc: Plug memory disclosures from PMC_OP_{GETPMCINFO,GETCPUINFO}.
  
  admbugs:	765

Modified:
  stable/11/sys/dev/hwpmc/hwpmc_mod.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/dev/hwpmc/hwpmc_mod.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/dev/hwpmc/hwpmc_mod.c
==============================================================================
--- stable/11/sys/dev/hwpmc/hwpmc_mod.c	Wed Jan 23 17:34:01 2019	(r343349)
+++ stable/11/sys/dev/hwpmc/hwpmc_mod.c	Wed Jan 23 17:36:58 2019	(r343350)
@@ -2990,6 +2990,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_a
 		struct pmc_classdep *pcd;
 		int cl;
 
+		memset(&gci, 0, sizeof(gci));
 		gci.pm_cputype = md->pmd_cputype;
 		gci.pm_ncpu    = pmc_cpu_max();
 		gci.pm_npmc    = md->pmd_npmc;
@@ -3131,7 +3132,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_a
 		npmc = md->pmd_npmc;
 
 		pmcinfo_size = npmc * sizeof(struct pmc_info);
-		pmcinfo = malloc(pmcinfo_size, M_PMC, M_WAITOK);
+		pmcinfo = malloc(pmcinfo_size, M_PMC, M_WAITOK | M_ZERO);
 
 		p = pmcinfo;
 


More information about the svn-src-all mailing list