diff options
author | bdrewery <bdrewery@FreeBSD.org> | 2014-03-14 01:43:55 +0000 |
---|---|---|
committer | bdrewery <bdrewery@FreeBSD.org> | 2014-03-14 01:43:55 +0000 |
commit | f6fb7805fca208bc9b8d1ffb0e03fb78fe004846 (patch) | |
tree | 5ae86b74cba0d9ac0ee8c1bb4a77c9a67893af8a /sys/fs | |
parent | fd2362b1d8bff5560938631a27c38d5192d54450 (diff) | |
download | FreeBSD-src-f6fb7805fca208bc9b8d1ffb0e03fb78fe004846.zip FreeBSD-src-f6fb7805fca208bc9b8d1ffb0e03fb78fe004846.tar.gz |
Fix -o size less than PAGE_SIZE resulting in SIZE_MAX being used.
Discussed with: kib
MFC after: 2 weeks
Diffstat (limited to 'sys/fs')
-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) { |