fb: handle allocation failure in alloc_apertures()
authorDan Carpenter <error27@gmail.com>
Thu, 15 Jul 2010 08:39:47 +0000 (10:39 +0200)
committerDave Airlie <airlied@redhat.com>
Tue, 20 Jul 2010 05:24:09 +0000 (15:24 +1000)
If the kzalloc() fails we should return NULL.  All the places that call
alloc_apertures() check for this already.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: James Simmons <jsimmons@infradead.org>
Acked-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
include/linux/fb.h

index 8e5a9dfb76bf6425934a09427b8f16df82e937be..e7445df44d6c9324fd32a85ee1145415ecbd7960 100644 (file)
@@ -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;
 }