mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-28 07:13:34 +00:00
rtc: mt6397: check return value after calling platform_get_resource()
[ Upstream commitd3b43eb505
] It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value. Fixes:fc2979118f
("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 Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
d5422f3238
commit
79fa3f5758
1 changed files with 2 additions and 0 deletions
|
@ -339,6 +339,8 @@ static int mtk_rtc_probe(struct platform_device *pdev)
|
|||
return -ENOMEM;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!res)
|
||||
return -EINVAL;
|
||||
rtc->addr_base = res->start;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
|
||||
|
|
Loading…
Reference in a new issue