Page MenuHomeFreeBSD

D32127.id95669.diff
No OneTemporary

D32127.id95669.diff

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
@@ -797,7 +797,7 @@
void *res;
size_t asize;
- KASSERT(align != 0 && powerof2(align),
+ KASSERT(powerof2(align),
("malloc_domainset_aligned: wrong align %#zx size %#zx",
align, size));
KASSERT(align <= PAGE_SIZE,
@@ -812,6 +812,8 @@
* align, since malloc zones provide alignment equal to their
* size.
*/
+ if (size == 0)
+ size = 1;
asize = size <= align ? align : 1UL << flsl(size - 1);
res = malloc_domainset(asize, mtp, ds, flags);
diff --git a/sys/x86/x86/busdma_bounce.c b/sys/x86/x86/busdma_bounce.c
--- a/sys/x86/x86/busdma_bounce.c
+++ b/sys/x86/x86/busdma_bounce.c
@@ -453,6 +453,7 @@
/*
* Allocate the buffer from the malloc(9) allocator if...
* - It's small enough to fit into a single page.
+ * - It's alignment requirement is also smaller than the page size.
* - The low address requirement is fulfilled.
* - Default cache attributes are requested (WB).
* else allocate non-contiguous pages if...
@@ -467,6 +468,7 @@
* Warn the user if malloc gets it wrong.
*/
if (dmat->common.maxsize <= PAGE_SIZE &&
+ dmat->common.alignment <= PAGE_SIZE &&
dmat->common.lowaddr >= ptoa((vm_paddr_t)Maxmem) &&
attr == VM_MEMATTR_DEFAULT) {
*vaddr = malloc_domainset_aligned(dmat->common.maxsize,

File Metadata

Mime Type
text/plain
Expires
Fri, Jul 3, 10:47 PM (2 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34640356
Default Alt Text
D32127.id95669.diff (1 KB)

Event Timeline