All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] rtc: gemini: add return value validation
@ 2017-04-23 12:48 ` Pan Bian
  0 siblings, 0 replies; 8+ messages in thread
From: Pan Bian @ 2017-04-23 12:48 UTC (permalink / raw)
  To: Hans Ulli Kroll, Alessandro Zummo, Alexandre Belloni, rtc-linux
  Cc: linux-arm-kernel, linux-kernel, Pan Bian

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [rtc-linux] [PATCH 1/1] rtc: gemini: add return value validation
@ 2017-04-23 12:48 ` Pan Bian
  0 siblings, 0 replies; 8+ messages in thread
From: Pan Bian @ 2017-04-23 12:48 UTC (permalink / raw)
  To: Hans Ulli Kroll, Alessandro Zummo, Alexandre Belloni, rtc-linux
  Cc: linux-arm-kernel, linux-kernel, Pan Bian

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


-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 1/1] rtc: gemini: add return value validation
@ 2017-04-23 12:48 ` Pan Bian
  0 siblings, 0 replies; 8+ messages in thread
From: Pan Bian @ 2017-04-23 12:48 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] rtc: gemini: add return value validation
  2017-04-23 12:48 ` [rtc-linux] " Pan Bian
@ 2017-04-27  4:22   ` Hans Ulli Kroll
  -1 siblings, 0 replies; 8+ messages in thread
From: Hans Ulli Kroll @ 2017-04-27  4:22 UTC (permalink / raw)
  To: Pan Bian
  Cc: Hans Ulli Kroll, Alessandro Zummo, Alexandre Belloni, rtc-linux,
	linux-arm-kernel, linux-kernel, Pan Bian

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>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/1] rtc: gemini: add return value validation
@ 2017-04-27  4:22   ` Hans Ulli Kroll
  0 siblings, 0 replies; 8+ messages in thread
From: Hans Ulli Kroll @ 2017-04-27  4:22 UTC (permalink / raw)
  To: linux-arm-kernel

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>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] rtc: gemini: add return value validation
  2017-04-23 12:48 ` [rtc-linux] " Pan Bian
  (?)
@ 2017-05-04 22:58   ` Alexandre Belloni
  -1 siblings, 0 replies; 8+ messages in thread
From: Alexandre Belloni @ 2017-05-04 22:58 UTC (permalink / raw)
  To: Pan Bian
  Cc: Hans Ulli Kroll, Alessandro Zummo, rtc-linux, linux-arm-kernel,
	linux-kernel, Pan Bian

On 23/04/2017 at 20:48:07 +0800, 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(+)
> 
Applied, thanks.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [rtc-linux] Re: [PATCH 1/1] rtc: gemini: add return value validation
@ 2017-05-04 22:58   ` Alexandre Belloni
  0 siblings, 0 replies; 8+ messages in thread
From: Alexandre Belloni @ 2017-05-04 22:58 UTC (permalink / raw)
  To: Pan Bian
  Cc: Hans Ulli Kroll, Alessandro Zummo, rtc-linux, linux-arm-kernel,
	linux-kernel, Pan Bian

On 23/04/2017 at 20:48:07 +0800, 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(+)
> 
Applied, thanks.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/1] rtc: gemini: add return value validation
@ 2017-05-04 22:58   ` Alexandre Belloni
  0 siblings, 0 replies; 8+ messages in thread
From: Alexandre Belloni @ 2017-05-04 22:58 UTC (permalink / raw)
  To: linux-arm-kernel

On 23/04/2017 at 20:48:07 +0800, 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(+)
> 
Applied, thanks.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-05-04 22:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-23 12:48 [PATCH 1/1] rtc: gemini: add return value validation Pan Bian
2017-04-23 12:48 ` Pan Bian
2017-04-23 12:48 ` [rtc-linux] " Pan Bian
2017-04-27  4:22 ` Hans Ulli Kroll
2017-04-27  4:22   ` Hans Ulli Kroll
2017-05-04 22:58 ` Alexandre Belloni
2017-05-04 22:58   ` Alexandre Belloni
2017-05-04 22:58   ` [rtc-linux] " Alexandre Belloni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.