diff options
author | bdrewery <bdrewery@FreeBSD.org> | 2014-03-30 16:51:12 +0000 |
---|---|---|
committer | bdrewery <bdrewery@FreeBSD.org> | 2014-03-30 16:51:12 +0000 |
commit | 6dfd032c5729a991eebc2481cc29578b9588f23b (patch) | |
tree | 9f59fd755a6370efcf80b65f0f09f18c6a7fad22 /sys | |
parent | e696b793ca74d2408093f408357dbd274417dffa (diff) | |
download | FreeBSD-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')
-rw-r--r-- | sys/fs/tmpfs/tmpfs_vfsops.c | 6 |
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) { |