[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH 1/3] lib/ukalloc: uk_posix_memalign_ifpages: use uintptr_t*
Using a uintptr_t* to store the return value of uk_palloc does not make sense here: we want to store a pointer, not a pointer to a pointer. Also, other functions from the page allocation API use uintptr_t, not uintptr_t* (uk_malloc_ifpages for instance). Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@xxxxxxxxx> --- lib/ukalloc/alloc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/ukalloc/alloc.c b/lib/ukalloc/alloc.c index 1f22583..b1946dc 100644 --- a/lib/ukalloc/alloc.c +++ b/lib/ukalloc/alloc.c @@ -234,7 +234,7 @@ int uk_posix_memalign_ifpages(struct uk_alloc *a, { struct metadata_ifpages *metadata; unsigned long num_pages; - uintptr_t *intptr; + uintptr_t intptr; size_t realsize, metadata_space; UK_ASSERT(a); @@ -272,17 +272,16 @@ int uk_posix_memalign_ifpages(struct uk_alloc *a, */ realsize = size + metadata_space + align; num_pages = size_to_num_pages(realsize); - intptr = uk_palloc(a, num_pages); + intptr = (uintptr_t) uk_palloc(a, num_pages); if (!intptr) return ENOMEM; - *memptr = (void *) ALIGN_UP((uintptr_t)intptr + metadata_space, - (uintptr_t)align); + *memptr = (void *) ALIGN_UP(intptr + metadata_space, (uintptr_t) align); metadata = uk_get_metadata(*memptr); metadata->num_pages = num_pages; - metadata->base = intptr; + metadata->base = (void *) intptr; return 0; } -- 2.7.4 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |