mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
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: Pan Bian <[email protected]> Acked-by: Hans Ulli Kroll <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
This commit is contained in:
parent
758929005f
commit
332e0d13d3
1 changed files with 2 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue