Commit 772a2f9b authored by Dan Carpenter's avatar Dan Carpenter Committed by Dave Airlie
Browse files

fb: handle allocation failure in alloc_apertures()

If the kzalloc() fails we should return NULL.  All the places that call
alloc_apertures() check for this already.
Signed-off-by: default avatarDan Carpenter <>
Acked-by: James Simmons's avatarJames Simmons <>
Acked-by: Marcin Ślusarz's avatarMarcin Slusarz <>
Signed-off-by: default avatarDave Airlie <>
parent bbb642f9
......@@ -873,6 +873,8 @@ struct fb_info {
static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
struct apertures_struct *a = kzalloc(sizeof(struct apertures_struct)
+ max_num * sizeof(struct aperture), GFP_KERNEL);
if (!a)
return NULL;
a->count = max_num;
return a;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment