[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH v2] lib/alloc: check for missing palloc implementation
Add NULL pointer check to uk_palloc in order to avoid NULL pointer dereference when palloc is not implemented by the allocator. Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@xxxxxxxxx> --- Changed since v1: * encapsulate both !a and !a->palloc under a single unlikely hint. diff --git a/lib/ukalloc/include/uk/alloc.h b/lib/ukalloc/include/uk/alloc.h index 634bb3f..798d45a 100644 --- a/lib/ukalloc/include/uk/alloc.h +++ b/lib/ukalloc/include/uk/alloc.h @@ -201,7 +201,7 @@ static inline void *uk_do_palloc(struct uk_alloc *a, size_t order) } static inline void *uk_palloc(struct uk_alloc *a, size_t order) { - if (unlikely(!a)) + if (unlikely(!a || !a->palloc)) return NULL; return a->palloc(a, order); } -- 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 |