Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Jan 2019 17:36:59 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r343350 - in stable: 11/sys/dev/hwpmc 12/sys/dev/hwpmc
Message-ID:  <201901231736.x0NHax5J005590@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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/12/sys/dev/hwpmc/hwpmc_mod.c
Directory Properties:
  stable/12/   (props changed)

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

Modified: stable/12/sys/dev/hwpmc/hwpmc_mod.c
==============================================================================
--- stable/12/sys/dev/hwpmc/hwpmc_mod.c	Wed Jan 23 17:34:01 2019	(r343349)
+++ stable/12/sys/dev/hwpmc/hwpmc_mod.c	Wed Jan 23 17:36:58 2019	(r343350)
@@ -3512,6 +3512,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;
@@ -3661,7 +3662,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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901231736.x0NHax5J005590>