dsp_fbexport: use kzalloc
Subsystems (2)
PATCH 1/1 dsp_fbexport: use kzalloc
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.
---
---
arch/arm/plat-omap/dsp/dsp_mem.c | 2 1 + 1 - 0 !
1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/plat-omap/dsp/dsp_mem.c +1 -1
@@ -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" );
Quoted 22 lines · Arnaud Patard
The
dsp_exportfunction callsomapfb_register_client()right after allocating the memory with kmalloc.
A commit added toomapfb_register_client()a check on the value ofplane_idxin 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).
Usingkzalloc()fixes the issue.Signed-off-by Arnaud Patard <[email protected]>---
---
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
===================================================================
arch/arm/plat-omap/dsp/dsp_mem.c static int dsp_fbexport(dsp_long_t *dspa · line 1501
Quoted 8 lines
arch/arm/plat-omap/dsp/dsp_mem.c +1
-1@@ -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