From: Dan Carpenter Date: Thu, 15 Jul 2010 08:39:47 +0000 (+0200) Subject: fb: handle allocation failure in alloc_apertures() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=772a2f9b488f4d27c314da5eeabde750b9ead41b;p=openwrt%2Fstaging%2Fblogic.git 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: Dan Carpenter Acked-by: James Simmons Acked-by: Marcin Slusarz Signed-off-by: Dave Airlie --- diff --git a/include/linux/fb.h b/include/linux/fb.h index 8e5a9dfb76bf..e7445df44d6c 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -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; }