projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fb60291
)
rtc: mt6397: check return value after calling platform_get_resource()
author
Yang Yingliang
<yangyingliang@huawei.com>
Thu, 5 May 2022 12:50:43 +0000
(20:50 +0800)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Tue, 14 Jun 2022 16:36:07 +0000
(18:36 +0200)
[ Upstream commit
d3b43eb505bffb8e4cdf6800c15660c001553fe6
]
It will cause null-ptr-deref if platform_get_resource() returns NULL,
we need check the return value.
Fixes: fc2979118f3f ("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>
drivers/rtc/rtc-mt6397.c
patch
|
blob
|
history
diff --git
a/drivers/rtc/rtc-mt6397.c
b/drivers/rtc/rtc-mt6397.c
index 80dc479a6ff02f63b49f9fba67bf40808507ce92..1d297af80f878818f5ee6ca00a6aab7f501b9742 100644
(file)
--- a/
drivers/rtc/rtc-mt6397.c
+++ b/
drivers/rtc/rtc-mt6397.c
@@
-269,6
+269,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;
rtc->data = of_device_get_match_data(&pdev->dev);