aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/subr_busdma_bufalloc.c
diff options
context:
space:
mode:
authorRyan Stone <rstone@FreeBSD.org>2015-04-01 12:42:26 +0000
committerRyan Stone <rstone@FreeBSD.org>2015-04-01 12:42:26 +0000
commitf2c2231e0c55b53a044f36aec2941b157cefce4a (patch)
treea5f9ea26e9cde6035646a47810b3727348fe048b /sys/kern/subr_busdma_bufalloc.c
parent7dce9b515b54dfb62c8ad4a9d0c8ab3139b15233 (diff)
downloadsrc-f2c2231e0c55b53a044f36aec2941b157cefce4a.tar.gz
src-f2c2231e0c55b53a044f36aec2941b157cefce4a.zip
Fix integer truncation bug in malloc(9)
A couple of internal functions used by malloc(9) and uma truncated a size_t down to an int. This could cause any number of issues (e.g. indefinite sleeps, memory corruption) if any kernel subsystem tried to allocate 2GB or more through malloc. zfs would attempt such an allocation when run on a system with 2TB or more of RAM. Note to self: When this is MFCed, sparc64 needs the same fix. Differential revision: https://reviews.freebsd.org/D2106 Reviewed by: kib Reported by: Michael Fuckner <michael@fuckner.net> Tested by: Michael Fuckner <michael@fuckner.net> MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=280957
Diffstat (limited to 'sys/kern/subr_busdma_bufalloc.c')
-rw-r--r--sys/kern/subr_busdma_bufalloc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/subr_busdma_bufalloc.c b/sys/kern/subr_busdma_bufalloc.c
index a80a233f53b5..b0b1ba826d48 100644
--- a/sys/kern/subr_busdma_bufalloc.c
+++ b/sys/kern/subr_busdma_bufalloc.c
@@ -147,8 +147,8 @@ busdma_bufalloc_findzone(busdma_bufalloc_t ba, bus_size_t size)
}
void *
-busdma_bufalloc_alloc_uncacheable(uma_zone_t zone, int size, u_int8_t *pflag,
- int wait)
+busdma_bufalloc_alloc_uncacheable(uma_zone_t zone, vm_size_t size,
+ uint8_t *pflag, int wait)
{
#ifdef VM_MEMATTR_UNCACHEABLE
@@ -166,7 +166,7 @@ busdma_bufalloc_alloc_uncacheable(uma_zone_t zone, int size, u_int8_t *pflag,
}
void
-busdma_bufalloc_free_uncacheable(void *item, int size, u_int8_t pflag)
+busdma_bufalloc_free_uncacheable(void *item, vm_size_t size, uint8_t pflag)
{
kmem_free(kernel_arena, (vm_offset_t)item, size);