diff options
author | jh <jh@FreeBSD.org> | 2010-01-08 07:57:43 +0000 |
---|---|---|
committer | jh <jh@FreeBSD.org> | 2010-01-08 07:57:43 +0000 |
commit | 0f220ff694c3d9086e1e3bb60b85687f7da65df5 (patch) | |
tree | 28c575c674b2a384f193b34723e365c38a0dd5a2 /sys/fs | |
parent | 340e2e8fb8924a91431bad69833d169c2d51e224 (diff) | |
download | FreeBSD-src-0f220ff694c3d9086e1e3bb60b85687f7da65df5.zip FreeBSD-src-0f220ff694c3d9086e1e3bb60b85687f7da65df5.tar.gz |
- Change the type of size_max to u_quad_t because its value is converted
with vfs_scanopt(9) using the "%qu" format string.
- Limit the maximum value of size_max to (SIZE_MAX - PAGE_SIZE) to
prevent overflow in howmany() macro.
PR: kern/141194
Approved by: trasz (mentor)
MFC after: 2 weeks
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/tmpfs/tmpfs_vfsops.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index f0ae6be..d18bccd 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -185,8 +185,8 @@ tmpfs_mount(struct mount *mp) ino_t nodes; int error; /* Size counters. */ - ino_t nodes_max; - size_t size_max; + ino_t nodes_max; + u_quad_t size_max; /* Root node attributes. */ uid_t root_uid; @@ -239,7 +239,7 @@ 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) + if (size_max < PAGE_SIZE || size_max > (SIZE_MAX - PAGE_SIZE)) pages = SIZE_MAX; else pages = howmany(size_max, PAGE_SIZE); |