[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH] lib/ukalloc: uk_posix_memalign_ifpages: Return zero on success



According to the Linux Programmer's Manual,
posix_memalign() returns zero on success instead
of a pointer value.

Signed-off-by: Kenichi Yasukata <kenichi.yasukata@xxxxxxxxx>
---
 lib/ukalloc/alloc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/ukalloc/alloc.c b/lib/ukalloc/alloc.c
index 8a19421..85b3e00 100644
--- a/lib/ukalloc/alloc.c
+++ b/lib/ukalloc/alloc.c
@@ -225,7 +225,7 @@ int uk_posix_memalign_ifpages(struct uk_alloc *a,
 
        if (!size) {
                *memptr = NULL;
-               return 0;
+               return EINVAL;
        }
 
        /* For page-aligned memory blocks, the size information is not stored
@@ -244,7 +244,8 @@ int uk_posix_memalign_ifpages(struct uk_alloc *a,
                return ENOMEM;
 
        *intptr = order;
-       return ALIGN_UP((uintptr_t)intptr + sizeof(order), align);
+       *memptr = (void *) ALIGN_UP((uintptr_t)intptr + sizeof(order), align);
+       return 0;
 }
 
 #endif
@@ -268,7 +269,7 @@ void *uk_memalign_compat(struct uk_alloc *a, size_t align, 
size_t size)
        void *ptr;
 
        UK_ASSERT(a);
-       if (!uk_posix_memalign(a, &ptr, align, size))
+       if (uk_posix_memalign(a, &ptr, align, size) != 0)
                return NULL;
 
        return ptr;
-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.