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) {
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to