rtc: mt6397: Fix potential NULL dereference in mtk_rtc_probe
Subsystems (3)
PATCH 1/1 rtc: mt6397: Fix potential NULL dereference in mtk_rtc_probe
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 <[email protected]>
--- drivers/rtc/rtc-mt6397.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/rtc/rtc-mt6397.c +3 -0
@@ -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);
Signature · 1 line
2.17.1
Il 04/04/22 15:25, Miaoqian Lin ha scritto:
Quoted 5 lines
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 <[email protected]>
Reviewed-by AngeloGioacchino Del Regno <[email protected]>
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek