The branch stable/13 has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=deabab2f07190dd6d2a598868696edc790cfce8b

commit deabab2f07190dd6d2a598868696edc790cfce8b
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2021-09-24 19:38:53 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2021-10-01 00:32:23 +0000

    malloc_aligned(9): allow zero size and alignment
    
    (cherry picked from commit 71d31f1cf6012b143fd676f099430818ae949c3f)
---
 sys/kern/kern_malloc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index 364828e6a1e6..0fc4fcbc0539 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -777,7 +777,7 @@ malloc_domainset_aligned(size_t size, size_t align,
        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,
@@ -792,6 +792,8 @@ malloc_domainset_aligned(size_t size, size_t align,
         * 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);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to