提交 332e0d13 编写于 作者: P Pan Bian 提交者: Alexandre Belloni

rtc: gemini: add return value validation

Function devm_ioremap() will return a NULL pointer if it fails to remap
IO address, and its return value should be validated before it is used.
However, in function gemini_rtc_probe(), its return value is not
checked. This may result in bad memory access bugs on future access,
e.g. calling the function gemini_rtc_read_time().
Signed-off-by: NPan Bian <bianpan2016@163.com>
Acked-by: NHans Ulli Kroll <ulli.kroll@googlemail.com>
Signed-off-by: NAlexandre Belloni <alexandre.belloni@free-electrons.com>
上级 75892900
......@@ -139,6 +139,8 @@ static int gemini_rtc_probe(struct platform_device *pdev)
rtc->rtc_base = devm_ioremap(dev, res->start,
resource_size(res));
if (!rtc->rtc_base)
return -ENOMEM;
ret = devm_request_irq(dev, rtc->rtc_irq, gemini_rtc_interrupt,
IRQF_SHARED, pdev->name, dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册