Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1631854 > unrolled thread

Re: [PATCH 1/1] rtc: gemini: add return value validation

Started byHans Ulli Kroll <ulli.kroll@googlemail.com>
First post2017-04-27 06:30 +0200
Last post2017-04-27 06:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/1] rtc: gemini: add return value validation Hans Ulli Kroll <ulli.kroll@googlemail.com> - 2017-04-27 06:30 +0200

#1631854 — Re: [PATCH 1/1] rtc: gemini: add return value validation

FromHans Ulli Kroll <ulli.kroll@googlemail.com>
Date2017-04-27 06:30 +0200
SubjectRe: [PATCH 1/1] rtc: gemini: add return value validation
Message-ID<tAJe2-3Nk-1@gated-at.bofh.it>
HI Pan,

On Sun, 23 Apr 2017, Pan Bian wrote:

> From: Pan Bian <bianpan2016@163.com>
> 
> 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 <bianpan2016@163.com>
> ---
>  drivers/rtc/rtc-gemini.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-gemini.c b/drivers/rtc/rtc-gemini.c
> index ccf0dba..5279390 100644
> --- a/drivers/rtc/rtc-gemini.c
> +++ b/drivers/rtc/rtc-gemini.c
> @@ -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);
> -- 
> 1.9.1
> 
> 
> 

Acked-by: Hans Ulli Kroll <ulli.kroll@googlemail.com>

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web