clocksource: timer-ti-dm: Fix regression
PATCH 1/1 clocksource: timer-ti-dm: Fix regression
Clean-up commit 8c82723414d5 ("clocksource/drivers/timer-ti-dm: Switch to platform_get_irq") caused a regression where we now try to access uninitialized data for timer:
drivers/clocksource/timer-ti-dm.c: In function 'omap_dm_timer_probe':drivers/clocksource/timer-ti-dm.c:798:13: warning: 'timer' may be used uninitialized in this function [-Wmaybe-uninitialized]
On boot we now get:
Unable to handle kernel NULL pointer dereference at virtual address
00000004
...
(omap_dm_timer_probe) from [<c061ac7c>] (platform_drv_probe+0x48/0x98) (platform_drv_probe) from [<c0618c04>] (really_probe+0x1dc/0x348) (really_probe) from [<c0618ef4>] (driver_probe_device+0x5c/0x160)
Let's fix the issue by moving platform_get_irq to happen after timer has been allocated.
---
I did not notice simlar issue with other patches in the series, but please do double check Yangtao.
--- drivers/clocksource/timer-ti-dm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clocksource/timer-ti-dm.c +4 -4
@@ -795,14 +795,14 @@ static int omap_dm_timer_probe(struct platform_device *pdev)return -ENODEV ; } - timer->irq =platform_get_irq (pdev,0 ); -if (timer->irq <0 ) -return timer->irq; - timer =devm_kzalloc (dev,sizeof (*timer),GFP_KERNEL );if (!timer)return -ENOMEM ; + timer->irq =platform_get_irq (pdev,0 ); +if (timer->irq <0 ) +return timer->irq; + timer->fclk =ERR_PTR (-ENODEV ); timer->io_base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (timer->io_base))
Signature · 1 line
2.24.1
Quoted 18 lines · Tony Lindgren
Clean-up commit
8c82723414d5("clocksource/drivers/timer-ti-dm: Switch toplatform_get_irq") caused a regression where we now try to access uninitialized data for timer:
drivers/clocksource/timer-ti-dm.c: In function 'omap_dm_timer_probe':drivers/clocksource/timer-ti-dm.c:798:13: warning: 'timer' may be used uninitialized in this function [-Wmaybe-uninitialized]On boot we now get:
Unable to handle kernel NULL pointer dereference at virtual address00000004
...
(omap_dm_timer_probe) from [<c061ac7c>] (platform_drv_probe+0x48/0x98) (platform_drv_probe) from [<c0618c04>] (really_probe+0x1dc/0x348) (really_probe) from [<c0618ef4>] (driver_probe_device+0x5c/0x160)
Quoted 6 lines
Let's fix the issue by moving
platform_get_irqto happen after timer has been allocated.Fixes 8c82723414d5 ("clocksource/drivers/timer-ti-dm: Switch to platform_get_irq")Cc Yangtao Li <[email protected]>Signed-off-by Tony Lindgren <[email protected]>
Quoted 4 lines
---
I did not notice simlar issue with other patches in the series, but please do double check Yangtao.
Yeah, this even seems to be caught at build (but our builds have been so noisy with warnings lately that they're hard to spot):
/build/drivers/clocksource/timer-ti-dm.c: In function 'omap_dm_timer_probe':
/build/drivers/clocksource/timer-ti-dm.c:798:13: warning: 'timer' may be used uninitialized in this function [-Wmaybe-uninitialized]
798 | timer->irq = platform_get_irq(pdev, 0);
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~-Olof
Frank Lee
Acked-byQuoted 20 lines · Olof Johansson
Quoted 18 lines · Tony Lindgren
Clean-up commit
8c82723414d5("clocksource/drivers/timer-ti-dm: Switch toplatform_get_irq") caused a regression where we now try to access uninitialized data for timer:
drivers/clocksource/timer-ti-dm.c: In function 'omap_dm_timer_probe':drivers/clocksource/timer-ti-dm.c:798:13: warning: 'timer' may be used uninitialized in this function [-Wmaybe-uninitialized]On boot we now get:
Unable to handle kernel NULL pointer dereference at virtual address00000004
...
(omap_dm_timer_probe) from [<c061ac7c>] (platform_drv_probe+0x48/0x98) (platform_drv_probe) from [<c0618c04>] (really_probe+0x1dc/0x348) (really_probe) from [<c0618ef4>] (driver_probe_device+0x5c/0x160)
Quoted 8 lines
Quoted 6 lines
Let's fix the issue by moving
platform_get_irqto happen after timer has been allocated.Fixes 8c82723414d5 ("clocksource/drivers/timer-ti-dm: Switch to platform_get_irq")Cc Yangtao Li <[email protected]>Signed-off-by Tony Lindgren <[email protected]>Acked-by Olof Johansson <[email protected]>
I am sorry. I will pay attention next time.
Quoted 17 lines
Quoted 5 lines
---
I did not notice simlar issue with other patches in the series, but please do double check Yangtao.
Yeah, this even seems to be caught at build (but our builds have been so noisy with warnings lately that they're hard to spot):
/build/drivers/clocksource/timer-ti-dm.c: In function '
omap_dm_timer_probe':
/build/drivers/clocksource/timer-ti-dm.c:798:13: warning: 'timer' may be used uninitialized in this function [-Wmaybe-uninitialized]798 | timer->irq = platform_get_irq(pdev, 0); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~-Olof
Daniel Lezcano
AppliedQuoted 17 lines · Tony Lindgren
Clean-up commit
8c82723414d5("clocksource/drivers/timer-ti-dm: Switch toplatform_get_irq") caused a regression where we now try to access uninitialized data for timer:
drivers/clocksource/timer-ti-dm.c: In function 'omap_dm_timer_probe':drivers/clocksource/timer-ti-dm.c:798:13: warning: 'timer' may be used uninitialized in this function [-Wmaybe-uninitialized]On boot we now get:
Unable to handle kernel NULL pointer dereference at virtual address00000004
...
(omap_dm_timer_probe) from [<c061ac7c>] (platform_drv_probe+0x48/0x98) (platform_drv_probe) from [<c0618c04>] (really_probe+0x1dc/0x348) (really_probe) from [<c0618ef4>] (driver_probe_device+0x5c/0x160)
Quoted 7 lines
Let's fix the issue by moving
platform_get_irqto happen after timer has been allocated.Fixes 8c82723414d5 ("clocksource/drivers/timer-ti-dm: Switch to platform_get_irq")Cc Yangtao Li <[email protected]>Signed-off-by Tony Lindgren <[email protected]>---
Applied, thanks.
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Quoted 18 lines · Tony Lindgren
Clean-up commit
8c82723414d5("clocksource/drivers/timer-ti-dm: Switch toplatform_get_irq") caused a regression where we now try to access uninitialized data for timer:
drivers/clocksource/timer-ti-dm.c: In function 'omap_dm_timer_probe':drivers/clocksource/timer-ti-dm.c:798:13: warning: 'timer' may be used uninitialized in this function [-Wmaybe-uninitialized]On boot we now get:
Unable to handle kernel NULL pointer dereference at virtual address00000004
...
(omap_dm_timer_probe) from [<c061ac7c>] (platform_drv_probe+0x48/0x98) (platform_drv_probe) from [<c0618c04>] (really_probe+0x1dc/0x348) (really_probe) from [<c0618ef4>] (driver_probe_device+0x5c/0x160)
Quoted 4 lines
Let's fix the issue by moving
platform_get_irqto happen after timer has been allocated.Fixes 8c82723414d5 ("clocksource/drivers/timer-ti-dm: Switch to platform_get_irq")
Thanks for fixing this issue.
I have noticed arm BeagleBoard-X15 boot failed on linux next tree (5.5.0-rc5-next-20200110).
[ 6.157822] 8<--- cut here --- [ 6.160911] Unable to handle kernel NULL pointer dereference at virtual address 00000004 [ 6.169120] pgd = 25d83e32 [ 6.171903] [00000004] *pgd=80000080204003, *pmd=00000000 [ 6.177358] Internal error: Oops: a06 [#1] SMP ARM [ 6.182179] Modules linked in: [ 6.185260] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.5.0-rc5-next-20200110 #1 [ 6.192694] Hardware name: Generic DRA74X (Flattened Device Tree) [ 6.198832] PC is at omap_dm_timer_probe+0x48/0x310
- Naresh
Quoted 28 lines · Naresh Kamboju
Quoted 18 lines · Tony Lindgren
Clean-up commit
8c82723414d5("clocksource/drivers/timer-ti-dm: Switch toplatform_get_irq") caused a regression where we now try to access uninitialized data for timer:
drivers/clocksource/timer-ti-dm.c: In function 'omap_dm_timer_probe':drivers/clocksource/timer-ti-dm.c:798:13: warning: 'timer' may be used uninitialized in this function [-Wmaybe-uninitialized]On boot we now get:
Unable to handle kernel NULL pointer dereference at virtual address00000004
...
(omap_dm_timer_probe) from [<c061ac7c>] (platform_drv_probe+0x48/0x98) (platform_drv_probe) from [<c0618c04>] (really_probe+0x1dc/0x348) (really_probe) from [<c0618ef4>] (driver_probe_device+0x5c/0x160)Quoted 4 lines
Let's fix the issue by moving
platform_get_irqto happen after timer has been allocated.Fixes 8c82723414d5 ("clocksource/drivers/timer-ti-dm: Switch to platform_get_irq")Thanks for fixing this issue.
I have noticed arm BeagleBoard-X15 boot failed on linux next tree (5.5.0-rc5-next-20200110).
Quoted 11 lines
[ 6.157822] 8<--- cut here --- [ 6.160911] Unable to handle kernel NULL pointer dereference at virtual address 00000004 [ 6.169120] pgd = 25d83e32 [ 6.171903] [00000004] *pgd=80000080204003, *pmd=00000000 [ 6.177358] Internal error: Oops: a06 [#1] SMP ARM [ 6.182179] Modules linked in: [ 6.185260] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.5.0-rc5-next-20200110 #1 [ 6.192694] Hardware name: Generic DRA74X (Flattened Device Tree) [ 6.198832] PC is at omap_dm_timer_probe+0x48/0x310
Tony/Daniel,
This is still not in linux-next. Any idea when this will be pushed to linux-next branch?
- Keerthy
Quoted 3 lines
- Naresh
Quoted 45 lines · Keerthy
Quoted 30 lines · Naresh Kamboju
Quoted 19 lines · Tony Lindgren
Clean-up commit
8c82723414d5("clocksource/drivers/timer-ti-dm:
Switch toplatform_get_irq") caused a regression where we now try to access uninitialized data for timer:
drivers/clocksource/timer-ti-dm.c: In function 'omap_dm_timer_probe':drivers/clocksource/timer-ti-dm.c:798:13: warning: 'timer' may be used uninitialized in this function [-Wmaybe-uninitialized]On boot we now get:
Unable to handle kernel NULL pointer dereference at virtual address00000004
...
(omap_dm_timer_probe) from [<c061ac7c>] (platform_drv_probe+0x48/0x98) (platform_drv_probe) from [<c0618c04>] (really_probe+0x1dc/0x348) (really_probe) from [<c0618ef4>] (driver_probe_device+0x5c/0x160)Quoted 5 lines
Let's fix the issue by moving
platform_get_irqto happen after timer has been allocated.Fixes 8c82723414d5 ("clocksource/drivers/timer-ti-dm: Switch to
platform_get_irq")Thanks for fixing this issue.
I have noticed arm BeagleBoard-X15 boot failed on linux next tree (5.5.0-rc5-next-20200110).Quoted 11 lines
[ 6.157822] 8<--- cut here ---
[ 6.160911] Unable to handle kernel NULL pointer dereference at virtual address 00000004
[ 6.169120] pgd =25d83e32
[ 6.171903] [00000004] *pgd=80000080204003, *pmd=00000000 [ 6.177358] Internal error: Oops: a06 [#1] SMP ARM
[ 6.182179] Modules linked in:
[ 6.185260] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.5.0-rc5-next-20200110 #1
[ 6.192694] Hardware name: Generic DRA74X (Flattened Device Tree) [ 6.198832] PC is atomap_dm_timer_probe+0x48/0x310
Quoted 4 lines
Tony/Daniel,
This is still not in linux-next. Any idea when this will be pushed to linux-next branch?
It should be actually.
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
[tip: timers/core] clocksource/drivers/timer-ti-dm: Fix uninitialized pointer access
In reply to Tony LindgrenThe following commit has been merged into the timers/core branch of tip:
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 4341067cfc20582195f47383cf059589b2641465 Gitweb: https://git.kernel.org/tip/4341067cfc20582195f47383cf059589b2641465 Author: Tony Lindgren <[email protected]> AuthorDate: Mon, 06 Jan 2020 12:37:00 -08:00 Committer: Daniel Lezcano <[email protected]> CommitterDate: Thu, 16 Jan 2020 19:09:02 +01:00
clocksource/drivers/timer-ti-dm: Fix uninitialized pointer access
Clean-up commit 8c82723414d5 ("clocksource/drivers/timer-ti-dm: Switch to platform_get_irq") caused a regression where we now try to access uninitialized data for timer:
drivers/clocksource/timer-ti-dm.c: In function 'omap_dm_timer_probe':drivers/clocksource/timer-ti-dm.c:798:13: warning: 'timer' may be used uninitialized in this function [-Wmaybe-uninitialized]
On boot we now get:
Unable to handle kernel NULL pointer dereference at virtual address
00000004
...
(omap_dm_timer_probe) from [<c061ac7c>] (platform_drv_probe+0x48/0x98) (platform_drv_probe) from [<c0618c04>] (really_probe+0x1dc/0x348) (really_probe) from [<c0618ef4>] (driver_probe_device+0x5c/0x160)
Let's fix the issue by moving platform_get_irq to happen after timer has been allocated.
--- drivers/clocksource/timer-ti-dm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clocksource/timer-ti-dm.c +4 -4
@@ -795,14 +795,14 @@ static int omap_dm_timer_probe(struct platform_device *pdev)return -ENODEV ; } - timer->irq =platform_get_irq (pdev,0 ); -if (timer->irq <0 ) -return timer->irq; - timer =devm_kzalloc (dev,sizeof (*timer),GFP_KERNEL );if (!timer)return -ENOMEM ; + timer->irq =platform_get_irq (pdev,0 ); +if (timer->irq <0 ) +return timer->irq; + timer->fclk =ERR_PTR (-ENODEV ); timer->io_base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (timer->io_base))