public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dsp_fbexport: use kzalloc
@ 2006-11-08 10:58 Arnaud Patard
  2006-11-09 23:52 ` Tony Lindgren
  0 siblings, 1 reply; 2+ messages in thread
From: Arnaud Patard @ 2006-11-08 10:58 UTC (permalink / raw)
  To: linux-omap-open-source

[-- Attachment #1: Type: text/plain, Size: 426 bytes --]


The dsp_export function calls omapfb_register_client() right after
allocating the memory with kmalloc. 
A commit added to omapfb_register_client() a check on the value of
plane_idx in the notified block structure. As we're only using kmalloc,
you may end-up comparing garbage/random values (It even leads to a oops
on my n770). 
Using kzalloc() fixes the issue.

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
---


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: dsp_video_register_client.patch --]
[-- Type: text/x-patch, Size: 778 bytes --]

---
 arch/arm/plat-omap/dsp/dsp_mem.c |    2 	1 +	1 -	0 !
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-omap-2.6/arch/arm/plat-omap/dsp/dsp_mem.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/plat-omap/dsp/dsp_mem.c	2006-11-07 23:43:12.000000000 +0100
+++ linux-omap-2.6/arch/arm/plat-omap/dsp/dsp_mem.c	2006-11-07 23:43:30.000000000 +0100
@@ -1495,7 +1495,7 @@ static int dsp_fbexport(dsp_long_t *dspa
 #endif
 
 #ifdef CONFIG_FB_OMAP_LCDC_EXTERNAL
-	omapfb_nb = kmalloc(sizeof(struct omapfb_notifier_block), GFP_KERNEL);
+	omapfb_nb = kzalloc(sizeof(struct omapfb_notifier_block), GFP_KERNEL);
 	if (omapfb_nb == NULL) {
 		printk(KERN_ERR
 		       "omapdsp: failed to allocate memory for omapfb_nb!\n");

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] dsp_fbexport: use kzalloc
  2006-11-08 10:58 [PATCH] dsp_fbexport: use kzalloc Arnaud Patard
@ 2006-11-09 23:52 ` Tony Lindgren
  0 siblings, 0 replies; 2+ messages in thread
From: Tony Lindgren @ 2006-11-09 23:52 UTC (permalink / raw)
  To: Arnaud Patard; +Cc: linux-omap-open-source

* Arnaud Patard <arnaud.patard@rtp-net.org> [061108 13:08]:
> 
> The dsp_export function calls omapfb_register_client() right after
> allocating the memory with kmalloc. 
> A commit added to omapfb_register_client() a check on the value of
> plane_idx in the notified block structure. As we're only using kmalloc,
> you may end-up comparing garbage/random values (It even leads to a oops
> on my n770). 
> Using kzalloc() fixes the issue.
> 
> Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
> ---
> 

> ---
>  arch/arm/plat-omap/dsp/dsp_mem.c |    2 	1 +	1 -	0 !
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Index: linux-omap-2.6/arch/arm/plat-omap/dsp/dsp_mem.c
> ===================================================================
> --- linux-omap-2.6.orig/arch/arm/plat-omap/dsp/dsp_mem.c	2006-11-07 23:43:12.000000000 +0100
> +++ linux-omap-2.6/arch/arm/plat-omap/dsp/dsp_mem.c	2006-11-07 23:43:30.000000000 +0100
> @@ -1495,7 +1495,7 @@ static int dsp_fbexport(dsp_long_t *dspa
>  #endif
>  
>  #ifdef CONFIG_FB_OMAP_LCDC_EXTERNAL
> -	omapfb_nb = kmalloc(sizeof(struct omapfb_notifier_block), GFP_KERNEL);
> +	omapfb_nb = kzalloc(sizeof(struct omapfb_notifier_block), GFP_KERNEL);
>  	if (omapfb_nb == NULL) {
>  		printk(KERN_ERR
>  		       "omapdsp: failed to allocate memory for omapfb_nb!\n");

Pushing today.

Tony

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-11-09 23:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-08 10:58 [PATCH] dsp_fbexport: use kzalloc Arnaud Patard
2006-11-09 23:52 ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox