Skip to content

Commit d3b43eb

Browse files
Yang Yingliangalexandrebelloni
authored andcommitted
rtc: mt6397: 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: fc29791 ("rtc: mediatek: Add MT6397 RTC driver") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20220505125043.1594771-1-yangyingliang@huawei.com
1 parent e60e8a7 commit d3b43eb

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/rtc/rtc-mt6397.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ static int mtk_rtc_probe(struct platform_device *pdev)
269269
return -ENOMEM;
270270

271271
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
272+
if (!res)
273+
return -EINVAL;
272274
rtc->addr_base = res->start;
273275

274276
rtc->data = of_device_get_match_data(&pdev->dev);

0 commit comments

Comments
 (0)