* [patch] fb: handle allocation failure in alloc_apertures()
@ 2010-07-15 8:39 Dan Carpenter
2010-07-15 14:35 ` James Simmons
2010-07-15 18:32 ` Marcin Slusarz
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2010-07-15 8:39 UTC (permalink / raw)
To: linux-fbdev
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>
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 8e5a9df..e7445df 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;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch] fb: handle allocation failure in alloc_apertures()
2010-07-15 8:39 [patch] fb: handle allocation failure in alloc_apertures() Dan Carpenter
@ 2010-07-15 14:35 ` James Simmons
2010-07-15 18:32 ` Marcin Slusarz
1 sibling, 0 replies; 3+ messages in thread
From: James Simmons @ 2010-07-15 14:35 UTC (permalink / raw)
To: linux-fbdev
> 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>
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index 8e5a9df..e7445df 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;
> }
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] fb: handle allocation failure in alloc_apertures()
2010-07-15 8:39 [patch] fb: handle allocation failure in alloc_apertures() Dan Carpenter
2010-07-15 14:35 ` James Simmons
@ 2010-07-15 18:32 ` Marcin Slusarz
1 sibling, 0 replies; 3+ messages in thread
From: Marcin Slusarz @ 2010-07-15 18:32 UTC (permalink / raw)
To: linux-fbdev
On Thu, Jul 15, 2010 at 10:39:47AM +0200, Dan Carpenter wrote:
> If the kzalloc() fails we should return NULL. All the places that call
> alloc_apertures() check for this already.
Thanks for fixing this. I added this function, so FWIW:
Acked-by: Marcin Slusarz <marcin.slusarz@gmail.com>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index 8e5a9df..e7445df 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;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-07-15 18:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-15 8:39 [patch] fb: handle allocation failure in alloc_apertures() Dan Carpenter
2010-07-15 14:35 ` James Simmons
2010-07-15 18:32 ` Marcin Slusarz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).