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

[Minios-devel] [UNIKRAFT/LIBGO PATCH] Fix error handling with uk_posix_memalign()



In the cases of failed allocation, `uk_posix_memalign()` is returning
an errno number but does not change `memptr`. Instead of checking
`memptr` being NULL, we test failures with `uk_posix_memalign()`'s
return codes.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 glue.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/glue.c b/glue.c
index d8dd695..301b0db 100644
--- a/glue.c
+++ b/glue.c
@@ -296,9 +296,8 @@ void *alloc_stack()
        struct uk_sched *sched = uk_sched_get_default();
        void *stack;
 
-       uk_posix_memalign(sched->allocator,
-                         &stack, __STACK_SIZE, __STACK_SIZE);
-       if (stack == NULL)
+       if (uk_posix_memalign(sched->allocator, &stack,
+                             __STACK_SIZE, __STACK_SIZE) != 0)
                printf("error allocating stack\n");
        return stack;
 }
-- 
2.20.1


_______________________________________________
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®.