Skip to contentSkip to conversation

ARM: imx: fix error handling in ipu device registration

PATCH New Shawn Guo 2 participants 3 messages May 19, 2014 – May 22, 2014

Subsystems (3)
lore
Share & tools
lore

Shawn Guo

author
#0 lore raw

PATCH 1/1 ARM: imx: fix error handling in ipu device registration

From: Emil Goode <[email protected]>

If we fail to allocate struct platform_device pdev we dereference it after the goto label err.

This bug was found using coccinelle.

Fixes afa77ef (ARM: mx3: dynamically allocate "ipu-core" devices)

---
Arnd, Olof,

Please consider to apply this fix for 3.15. Thanks.

Shawn

 arch/arm/mach-imx/devices/platform-ipu-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/devices/platform-ipu-core.c +1 -1
index fc4dd7c..6bd7c3f 100644
@@ -77,7 +77,7 @@ struct platform_device *__init imx_alloc_mx3_camera(
 
 	pdev = platform_device_alloc("mx3-camera", 0);
 	if (!pdev)
-		goto err;
+		return ERR_PTR(-ENOMEM);
 
 	pdev->dev.dma_mask = kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);
 	if (!pdev->dev.dma_mask)
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/1 ARM: imx: fix error handling in ipu device registration

Quoted 12 lines · Shawn Guo

From: Emil Goode <[email protected]>

If we fail to allocate struct platform_device pdev we dereference it after the goto label err.

This bug was found using coccinelle.

Fixes afa77ef (ARM: mx3: dynamically allocate "ipu-core" devices)
Quoted 4 lines

---
Arnd, Olof,

Please consider to apply this fix for 3.15. Thanks.

Applied, thanks.

BTW, it was requested to use a 12-character SHA in the Fixes: tag, since in the future there might be a collision on the shortest one.

You can update the default for your git repo by setting the core.abbrevlength config variable to 12.

-Olof

author
#2 lore raw

PATCH 1/1 ARM: imx: fix error handling in ipu device registration

Quoted 5 lines · Olof Johansson

BTW, it was requested to use a 12-character SHA in the Fixes: tag, since in the future there might be a collision on the shortest one.

You can update the default for your git repo by setting the core.abbrevlength config variable to 12.

Done. Thanks for the hint, Olof.

BTW, not sure what your git version is, but with my version 1.8.3.2 the variable seems to be core.abbrev instead of core.abbrevlength, probably because of the change below?

http://git.kaarsemaker.net/git/commit/a71f09fe3e8b047d88b5f439c6d552e8fc7e8293/

Shawn