Skip to content

Commit f58ca21

Browse files
Yang Yingliangjernejsk
authored andcommitted
clk: sunxi: sun9i-mmc: check return value after calling platform_get_resource()
It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value. Fixes: 7a6fca8 ("clk: sunxi: Add driver for A80 MMC config clocks/resets") Signed-off-by: Yang Yingliang <[email protected]> Reviewed-by: Samuel Holland <[email protected]> Signed-off-by: Jernej Skrabec <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent b4f3d5f commit f58ca21

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/clk/sunxi/clk-sun9i-mmc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ static int sun9i_a80_mmc_config_clk_probe(struct platform_device *pdev)
109109
spin_lock_init(&data->lock);
110110

111111
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
112+
if (!r)
113+
return -EINVAL;
112114
/* one clock/reset pair per word */
113115
count = DIV_ROUND_UP((resource_size(r)), SUN9I_MMC_WIDTH);
114116
data->membase = devm_ioremap_resource(&pdev->dev, r);

0 commit comments

Comments
 (0)