Author: bdrewery
Date: Fri Mar 14 01:43:55 2014
New Revision: 263130
URL: http://svnweb.freebsd.org/changeset/base/263130

Log:
  Fix -o size less than PAGE_SIZE resulting in SIZE_MAX being used.
  
  Discussed with:       kib
  MFC after:    2 weeks

Modified:
  head/sys/fs/tmpfs/tmpfs_vfsops.c

Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c
==============================================================================
--- head/sys/fs/tmpfs/tmpfs_vfsops.c    Fri Mar 14 01:17:11 2014        
(r263129)
+++ head/sys/fs/tmpfs/tmpfs_vfsops.c    Fri Mar 14 01:43:55 2014        
(r263130)
@@ -200,11 +200,13 @@ tmpfs_mount(struct mount *mp)
         * allowed to use, based on the maximum size the user passed in
         * the mount structure.  A value of zero is treated as if the
         * maximum available space was requested. */
-       if (size_max < PAGE_SIZE || size_max > OFF_MAX - PAGE_SIZE ||
+       if (size_max == 0 || size_max > OFF_MAX - PAGE_SIZE ||
            (SIZE_MAX < OFF_MAX && size_max / PAGE_SIZE >= SIZE_MAX))
                pages = SIZE_MAX;
-       else
+       else {
+               size_max = roundup(size_max, PAGE_SIZE);
                pages = howmany(size_max, PAGE_SIZE);
+       }
        MPASS(pages > 0);
 
        if (nodes_max <= 3) {
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to