summaryrefslogtreecommitdiffstats
path: root/sys/fs/tmpfs/tmpfs_subr.c
diff options
context:
space:
mode:
authorjh <jh@FreeBSD.org>2010-01-20 16:56:20 +0000
committerjh <jh@FreeBSD.org>2010-01-20 16:56:20 +0000
commitc1e8eaa2ba35a24e0acc7420f46fbf01bd494e90 (patch)
tree097901165be53ed3a5c950d83ba73459eeada47e /sys/fs/tmpfs/tmpfs_subr.c
parentd1ed694608965dcaaa85f3d1eacedf3d704557b1 (diff)
downloadFreeBSD-src-c1e8eaa2ba35a24e0acc7420f46fbf01bd494e90.zip
FreeBSD-src-c1e8eaa2ba35a24e0acc7420f46fbf01bd494e90.tar.gz
- Change the type of nodes_max to u_int and use "%u" format string to
convert its value. [1] - Set default tm_nodes_max to min(pages + 3, UINT32_MAX). It's more reasonable than the old four nodes per page (with page size 4096) because non-empty regular files always use at least one page. This fixes possible overflow in the calculation. [2] - Don't allow more than tm_nodes_max nodes allocated in tmpfs_alloc_node(). PR: kern/138367 Suggested by: bde [1], Gleb Kurtsou [2] Approved by: trasz (mentor)
Diffstat (limited to 'sys/fs/tmpfs/tmpfs_subr.c')
-rw-r--r--sys/fs/tmpfs/tmpfs_subr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c
index 5b13e64..b6c5cfe 100644
--- a/sys/fs/tmpfs/tmpfs_subr.c
+++ b/sys/fs/tmpfs/tmpfs_subr.c
@@ -93,7 +93,7 @@ tmpfs_alloc_node(struct tmpfs_mount *tmp, enum vtype type,
MPASS(IFF(type == VLNK, target != NULL));
MPASS(IFF(type == VBLK || type == VCHR, rdev != VNOVAL));
- if (tmp->tm_nodes_inuse > tmp->tm_nodes_max)
+ if (tmp->tm_nodes_inuse >= tmp->tm_nodes_max)
return (ENOSPC);
nnode = (struct tmpfs_node *)uma_zalloc_arg(
OpenPOWER on IntegriCloud