|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH] 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.
---
lib/ukalloc/include/uk/alloc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ukalloc/include/uk/alloc.h b/lib/ukalloc/include/uk/alloc.h
index 634bb3f..2e73ab6 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) || unlikely(!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 |