Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153092225
D28219.id82558.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D28219.id82558.diff
View Options
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -768,20 +768,20 @@
struct malloc_type *mtp, struct domainset *ds, int flags)
{
void *res;
+ size_t asize;
KASSERT(align != 0 && powerof2(align),
("malloc_domainset_aligned: wrong align %#zx size %#zx",
align, size));
- KASSERT(align <= kmemzones[nitems(kmemzones) - 2].kz_size,
+ KASSERT(align <= PAGE_SIZE,
("malloc_domainset_aligned: align %#zx (size %#zx) too large",
align, size));
- if (size < align)
- size = align;
- res = malloc_domainset(size, mtp, ds, flags);
+ asize = 1UL << flsl(size);
+ res = malloc_domainset(asize, mtp, ds, flags);
KASSERT(res == NULL || ((uintptr_t)res & (align - 1)) == 0,
("malloc_domainset_aligned: result not aligned %p size %#zx "
- "align %#zx", res, size, align));
+ "allocsize %#zx align %#zx", res, size, asize, align));
return (res);
}
@@ -1173,7 +1173,7 @@
align = UMA_ALIGN_PTR;
if (powerof2(size) && size > sizeof(void *))
- align = size - 1;
+ align = MIN(size, PAGE_SIZE);
for (subzone = 0; subzone < numzones; subzone++) {
kmemzones[indx].kz_zone[subzone] =
uma_zcreate(name, size,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Apr 20, 2:11 AM (14 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31815591
Default Alt Text
D28219.id82558.diff (1 KB)
Attached To
Mode
D28219: Restrict supported alignment for malloc_domainset_aligned(9) to PAGE_SIZE.
Attached
Detach File
Event Timeline
Log In to Comment