Date: Sun, 30 Mar 2014 16:51:12 +0000 (UTC) From: Bryan Drewery <bdrewery@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r263943 - stable/10/sys/fs/tmpfs Message-ID: <201403301651.s2UGpCmf071644@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bdrewery Date: Sun Mar 30 16:51:12 2014 New Revision: 263943 URL: http://svnweb.freebsd.org/changeset/base/263943 Log: MFC r263130: Fix -o size less than PAGE_SIZE resulting in SIZE_MAX being used. Modified: stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Sun Mar 30 16:49:17 2014 (r263942) +++ stable/10/sys/fs/tmpfs/tmpfs_vfsops.c Sun Mar 30 16:51:12 2014 (r263943) @@ -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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403301651.s2UGpCmf071644>