fb: handle allocation failure in alloc_apertures()
Subsystems (2)
PATCH 1/1 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 <[email protected]>
include/linux/fb.h +2 -0
@@ -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; }
Quoted 5 lines
If the
kzalloc()fails we should return NULL. All the places that callalloc_apertures()check for this already.Signed-off-by Dan Carpenter <[email protected]>
Acked-by James Simmons <[email protected]>
Quoted 19 lines
include/linux/fb.h +2
-1@@ -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; } --To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 2 lines · Dan Carpenter
If the
kzalloc()fails we should return NULL. All the places that callalloc_apertures()check for this already.
Thanks for fixing this. I added this function, so FWIW:
Acked-by Marcin Slusarz <[email protected]>
Quoted 16 lines
Signed-off-by Dan Carpenter <[email protected]>include/linux/fb.h +2
-0@@ -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; }