svn commit: r295352 - head/sys/dev/hwpmc

Konstantin Belousov kib at FreeBSD.org
Sat Feb 6 15:39:05 UTC 2016


Author: kib
Date: Sat Feb  6 15:39:04 2016
New Revision: 295352
URL: https://svnweb.freebsd.org/changeset/base/295352

Log:
  Do not call vn_fullpath(9) (through the pmc_getfilename() wrapper)
  when its result is immediately ignored, i.e. for kernel processes
  forked from the user process.  Do not test for non-null before freeing
  string.
  
  Sponsored by:	The FreeBSD Foundation
  MFC after:	2 weeks

Modified:
  head/sys/dev/hwpmc/hwpmc_mod.c

Modified: head/sys/dev/hwpmc/hwpmc_mod.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_mod.c	Sat Feb  6 14:07:17 2016	(r295351)
+++ head/sys/dev/hwpmc/hwpmc_mod.c	Sat Feb  6 15:39:04 2016	(r295352)
@@ -1009,14 +1009,14 @@ pmc_attach_one_process(struct proc *p, s
 
 	/* issue an attach event to a configured log file */
 	if (pm->pm_owner->po_flags & PMC_PO_OWNS_LOGFILE) {
-		pmc_getfilename(p->p_textvp, &fullpath, &freepath);
 		if (p->p_flag & P_KTHREAD) {
 			fullpath = kernelname;
 			freepath = NULL;
-		} else
+		} else {
+			pmc_getfilename(p->p_textvp, &fullpath, &freepath);
 			pmclog_process_pmcattach(pm, p->p_pid, fullpath);
-		if (freepath)
-			free(freepath, M_TEMP);
+		}
+		free(freepath, M_TEMP);
 		if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm)))
 			pmc_log_process_mappings(pm->pm_owner, p);
 	}


More information about the svn-src-all mailing list