Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Feb 2016 15:39:04 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r295352 - head/sys/dev/hwpmc
Message-ID:  <201602061539.u16Fd47L082744@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 	}



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