From 6dfd032c5729a991eebc2481cc29578b9588f23b Mon Sep 17 00:00:00 2001 From: bdrewery Date: Sun, 30 Mar 2014 16:51:12 +0000 Subject: MFC r263130: Fix -o size less than PAGE_SIZE resulting in SIZE_MAX being used. --- sys/fs/tmpfs/tmpfs_vfsops.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sys/fs/tmpfs') diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index 57b9902..d5967ae 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -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) { -- cgit v1.1