From e812fd6053b92e8fae658b8731cc96c12f65270c Mon Sep 17 00:00:00 2001 From: Stewart Smith Date: Thu, 23 Feb 2017 14:21:55 +1100 Subject: buddy: Check zalloc() return value All callers of buddy_create() are correctly checking return value. Found by static analysis Fixes: 8594b9c5bd456205255ea2241ba224f47480efad Signed-off-by: Stewart Smith --- core/buddy.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'core/buddy.c') diff --git a/core/buddy.c b/core/buddy.c index 59cd2cb0..b98a229d 100644 --- a/core/buddy.c +++ b/core/buddy.c @@ -286,6 +286,8 @@ struct buddy *buddy_create(unsigned int max_order) bsize = BITMAP_BYTES(1u << (max_order + 1)); b = zalloc(sizeof(struct buddy) + bsize); + if (!b) + return NULL; b->max_order = max_order; BUDDY_NOISE("Map @%p, size: %d bytes\n", b->map, bsize); -- cgit v1.2.1