commit 44f68235e23ab4bababeafe07d31e07feabb84ba Author: Gleb Kurtsou Date: Tue Apr 3 00:02:33 2012 +0300 tmpfs: Support file system sizes up to 4GB*PAGE_SIZE on 32 bit archs diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index 29f2ca4..6b3ecc0 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -233,17 +233,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 > SIZE_MAX - PAGE_SIZE) + if (size_max < PAGE_SIZE || size_max > UINT64_MAX - PAGE_SIZE || + (SIZE_MAX < UINT64_MAX && size_max / PAGE_SIZE >= SIZE_MAX)) pages = SIZE_MAX; else pages = howmany(size_max, PAGE_SIZE); MPASS(pages > 0); - if (pages < SIZE_MAX / PAGE_SIZE) - size_max = pages * PAGE_SIZE; - else - size_max = SIZE_MAX; - if (nodes_max <= 3) { if (pages < INT_MAX / nodes_per_page) nodes_max = pages * nodes_per_page;