summaryrefslogtreecommitdiffstats
path: root/sys/fs/tmpfs
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2014-03-30 16:51:12 +0000
committerbdrewery <bdrewery@FreeBSD.org>2014-03-30 16:51:12 +0000
commit6dfd032c5729a991eebc2481cc29578b9588f23b (patch)
tree9f59fd755a6370efcf80b65f0f09f18c6a7fad22 /sys/fs/tmpfs
parente696b793ca74d2408093f408357dbd274417dffa (diff)
downloadFreeBSD-src-6dfd032c5729a991eebc2481cc29578b9588f23b.zip
FreeBSD-src-6dfd032c5729a991eebc2481cc29578b9588f23b.tar.gz
MFC r263130:
Fix -o size less than PAGE_SIZE resulting in SIZE_MAX being used.
Diffstat (limited to 'sys/fs/tmpfs')
-rw-r--r--sys/fs/tmpfs/tmpfs_vfsops.c6
1 files changed, 4 insertions, 2 deletions
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) {
OpenPOWER on IntegriCloud