Skip to content

Commit e60d556

Browse files
salah-trikigregkh
authored andcommitted
bus: fsl-mc: Check return value of platform_get_resource()
commit 25f5265 upstream. platform_get_resource() returns NULL in case of failure, so check its return value and propagate the error in order to prevent NULL pointer dereference. Fixes: 6305166 ("bus: fsl-mc: Add ACPI support for fsl-mc") Cc: [email protected] Signed-off-by: Salah Triki <[email protected]> Acked-by: Ioana Ciornei <[email protected]> Link: https://lore.kernel.org/r/aKwuK6TRr5XNYQ8u@pc Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent ba7f7c2 commit e60d556

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/bus/fsl-mc/fsl-mc-bus.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,9 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
11721172
* Get physical address of MC portal for the root DPRC:
11731173
*/
11741174
plat_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1175+
if (!plat_res)
1176+
return -EINVAL;
1177+
11751178
mc_portal_phys_addr = plat_res->start;
11761179
mc_portal_size = resource_size(plat_res);
11771180
mc_portal_base_phys_addr = mc_portal_phys_addr & ~0x3ffffff;

0 commit comments

Comments
 (0)