* [PATCH] rtc: mt6397: Fix potential NULL dereference in mtk_rtc_probe
@ 2022-04-04 13:25 Miaoqian Lin
2022-04-05 13:28 ` AngeloGioacchino Del Regno
0 siblings, 1 reply; 2+ messages in thread
From: Miaoqian Lin @ 2022-04-04 13:25 UTC (permalink / raw)
To: Eddie Huang, Sean Wang, Alessandro Zummo, Alexandre Belloni,
Matthias Brugger, Tianping Fang, linux-arm-kernel, linux-mediatek,
linux-rtc, linux-kernel
Cc: linmq006
platform_get_resource() may return NULL, add proper check to
avoid potential NULL dereferencing.
Fixes: fc2979118f3f ("rtc: mediatek: Add MT6397 RTC driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
drivers/rtc/rtc-mt6397.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
index 80dc479a6ff0..07c6679366e0 100644
--- a/drivers/rtc/rtc-mt6397.c
+++ b/drivers/rtc/rtc-mt6397.c
@@ -269,6 +269,9 @@ 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);
--
2.17.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rtc: mt6397: Fix potential NULL dereference in mtk_rtc_probe
2022-04-04 13:25 [PATCH] rtc: mt6397: Fix potential NULL dereference in mtk_rtc_probe Miaoqian Lin
@ 2022-04-05 13:28 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 2+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-04-05 13:28 UTC (permalink / raw)
To: Miaoqian Lin, Eddie Huang, Sean Wang, Alessandro Zummo,
Alexandre Belloni, Matthias Brugger, Tianping Fang,
linux-arm-kernel, linux-mediatek, linux-rtc, linux-kernel
Il 04/04/22 15:25, Miaoqian Lin ha scritto:
> platform_get_resource() may return NULL, add proper check to
> avoid potential NULL dereferencing.
>
> Fixes: fc2979118f3f ("rtc: mediatek: Add MT6397 RTC driver")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-05 13:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-04 13:25 [PATCH] rtc: mt6397: Fix potential NULL dereference in mtk_rtc_probe Miaoqian Lin
2022-04-05 13:28 ` AngeloGioacchino Del Regno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).