svn commit: r208858 - head/usr.sbin/pmcstat

Fabien Thomas fabient at FreeBSD.org
Sat Jun 5 22:57:54 UTC 2010


Author: fabient
Date: Sat Jun  5 22:57:53 2010
New Revision: 208858
URL: http://svn.freebsd.org/changeset/base/208858

Log:
  Fix warnings found by Coverity.
  
  Found with:   Coverity Prevent(tm)
  MFC after:	1 month

Modified:
  head/usr.sbin/pmcstat/pmcpl_calltree.c
  head/usr.sbin/pmcstat/pmcstat.c
  head/usr.sbin/pmcstat/pmcstat_log.c

Modified: head/usr.sbin/pmcstat/pmcpl_calltree.c
==============================================================================
--- head/usr.sbin/pmcstat/pmcpl_calltree.c	Sat Jun  5 21:39:52 2010	(r208857)
+++ head/usr.sbin/pmcstat/pmcpl_calltree.c	Sat Jun  5 22:57:53 2010	(r208858)
@@ -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: head/usr.sbin/pmcstat/pmcstat.c
==============================================================================
--- head/usr.sbin/pmcstat/pmcstat.c	Sat Jun  5 21:39:52 2010	(r208857)
+++ head/usr.sbin/pmcstat/pmcstat.c	Sat Jun  5 22:57:53 2010	(r208858)
@@ -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: head/usr.sbin/pmcstat/pmcstat_log.c
==============================================================================
--- head/usr.sbin/pmcstat/pmcstat_log.c	Sat Jun  5 21:39:52 2010	(r208857)
+++ head/usr.sbin/pmcstat/pmcstat_log.c	Sat Jun  5 22:57:53 2010	(r208858)
@@ -1957,6 +1957,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-head mailing list