svn commit: r210813 - stable/8/usr.sbin/pmcstat

Fabien Thomas fabient at FreeBSD.org
Tue Aug 3 16:21:50 UTC 2010


Author: fabient
Date: Tue Aug  3 16:21:49 2010
New Revision: 210813
URL: http://svn.freebsd.org/changeset/base/210813

Log:
  MFC r208858:
  
  Fix warnings found by Coverity.
  
  Found with:   Coverity Prevent(tm)

Modified:
  stable/8/usr.sbin/pmcstat/pmcpl_calltree.c
  stable/8/usr.sbin/pmcstat/pmcstat.c
  stable/8/usr.sbin/pmcstat/pmcstat_log.c
Directory Properties:
  stable/8/usr.sbin/pmcstat/   (props changed)

Modified: stable/8/usr.sbin/pmcstat/pmcpl_calltree.c
==============================================================================
--- stable/8/usr.sbin/pmcstat/pmcpl_calltree.c	Tue Aug  3 16:21:48 2010	(r210812)
+++ stable/8/usr.sbin/pmcstat/pmcpl_calltree.c	Tue Aug  3 16:21:49 2010	(r210813)
@@ -896,10 +896,12 @@ pmcpl_ct_node_printchild(struct pmcpl_ct
 			/* Call address, line, sample. */
 			addr = ct->pct_image->pi_vaddr + ct->pct_func;
 			line = 0;
-			pmcstat_image_addr2line(ct->pct_image, addr, sourcefile,
+			if (pmcstat_image_addr2line(ct->pct_image, addr, sourcefile,
 			    sizeof(sourcefile), &line,
-			    funcname, sizeof(funcname));
-			fprintf(args.pa_graphfile, "%p %u", (void *)addr, line);
+			    funcname, sizeof(funcname)))
+				fprintf(args.pa_graphfile, "%p %u", (void *)addr, line);
+			else
+				fprintf(args.pa_graphfile, "* *");
 		}
 		else
 			fprintf(args.pa_graphfile, "* *");

Modified: stable/8/usr.sbin/pmcstat/pmcstat.c
==============================================================================
--- stable/8/usr.sbin/pmcstat/pmcstat.c	Tue Aug  3 16:21:48 2010	(r210812)
+++ stable/8/usr.sbin/pmcstat/pmcstat.c	Tue Aug  3 16:21:49 2010	(r210813)
@@ -292,7 +292,8 @@ pmcstat_find_targets(const char *spec)
 		    0, &nproc)) == NULL)
 			err(EX_OSERR, "ERROR: Cannot get process list: %s",
 			    kvm_geterr(pmcstat_kvm));
-	}
+	} else
+		nproc = 0;
 
 	if ((rv = regcomp(&reg, spec, REG_EXTENDED|REG_NOSUB)) != 0) {
 		regerror(rv, &reg, errbuf, sizeof(errbuf));

Modified: stable/8/usr.sbin/pmcstat/pmcstat_log.c
==============================================================================
--- stable/8/usr.sbin/pmcstat/pmcstat_log.c	Tue Aug  3 16:21:48 2010	(r210812)
+++ stable/8/usr.sbin/pmcstat/pmcstat_log.c	Tue Aug  3 16:21:49 2010	(r210813)
@@ -1959,6 +1959,7 @@ pmcstat_keypress_log(void)
 	case 'q':
 		wprintw(w, "exiting...");
 		ret = 1;
+		break;
 	default:
 		if (plugins[args.pa_plugin].pl_topkeypress != NULL)
 			if (plugins[args.pa_plugin].pl_topkeypress(c, w))


More information about the svn-src-stable mailing list