svn commit: r317311 - head/lib/libgeom

Ngie Cooper ngie at FreeBSD.org
Sun Apr 23 01:47:53 UTC 2017


Author: ngie
Date: Sun Apr 23 01:47:51 2017
New Revision: 317311
URL: https://svnweb.freebsd.org/changeset/base/317311

Log:
  Check for failures from getpagesize(3)
  
  Return errno on failure, similar to the open(2) call above it.
  
  MFC after:	5 weeks
  Reported by:	Coverity
  CID:		1193753
  Sponsored by:	Dell EMC Isilon

Modified:
  head/lib/libgeom/geom_stats.c

Modified: head/lib/libgeom/geom_stats.c
==============================================================================
--- head/lib/libgeom/geom_stats.c	Sun Apr 23 01:17:59 2017	(r317310)
+++ head/lib/libgeom/geom_stats.c	Sun Apr 23 01:47:51 2017	(r317311)
@@ -87,6 +87,8 @@ geom_stats_open(void)
 	if (statsfd < 0)
 		return (errno);
 	pagesize = getpagesize();
+	if (pagesize == -1)
+		return (errno);
 	spp = pagesize / sizeof(struct devstat);
 	p = mmap(NULL, pagesize, PROT_READ, MAP_SHARED, statsfd, 0);
 	if (p == MAP_FAILED) {


More information about the svn-src-all mailing list