* [PATCH] clocksource: arm_arch_timer: Fix mem frame loop initialization
@ 2017-07-31 18:37 ` Matthias Kaehlcke
0 siblings, 0 replies; 6+ messages in thread
From: Matthias Kaehlcke @ 2017-07-31 18:37 UTC (permalink / raw)
To: linux-arm-kernel
The loop to find the best memory frame in arch_timer_mem_acpi_init()
initializes the loop counter with itself ('i = i'), which is suspicious
in the first place and pointed out by clang. The loop condition is
'i < timer_count' and a prior for loop exits when 'i' reaches
'timer_count', therefore the second loop is never executed.
Initialize the loop counter with 0 to iterate over all timers, which
supposedly was the intention before the typo monster attacked.
Fixes: c2743a36765d3 ("clocksource: arm_arch_timer: add GTDT support for memory-mapped timer")
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
drivers/clocksource/arm_arch_timer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index aae87c4c546e..72bbfccef113 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -1440,7 +1440,7 @@ static int __init arch_timer_mem_acpi_init(int platform_timer_count)
* While unlikely, it's theoretically possible that none of the frames
* in a timer expose the combination of feature we want.
*/
- for (i = i; i < timer_count; i++) {
+ for (i = 0; i < timer_count; i++) {
timer = &timers[i];
frame = arch_timer_mem_find_best_frame(timer);
--
2.14.0.rc0.400.g1c36432dff-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH] clocksource: arm_arch_timer: Fix mem frame loop initialization @ 2017-07-31 18:37 ` Matthias Kaehlcke 0 siblings, 0 replies; 6+ messages in thread From: Matthias Kaehlcke @ 2017-07-31 18:37 UTC (permalink / raw) To: Fu Wei, Mark Rutland, Marc Zyngier, Daniel Lezcano, Thomas Gleixner Cc: linux-kernel, linux-arm-kernel, Doug Anderson, Matthias Kaehlcke The loop to find the best memory frame in arch_timer_mem_acpi_init() initializes the loop counter with itself ('i = i'), which is suspicious in the first place and pointed out by clang. The loop condition is 'i < timer_count' and a prior for loop exits when 'i' reaches 'timer_count', therefore the second loop is never executed. Initialize the loop counter with 0 to iterate over all timers, which supposedly was the intention before the typo monster attacked. Fixes: c2743a36765d3 ("clocksource: arm_arch_timer: add GTDT support for memory-mapped timer") Signed-off-by: Matthias Kaehlcke <mka@chromium.org> --- drivers/clocksource/arm_arch_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index aae87c4c546e..72bbfccef113 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -1440,7 +1440,7 @@ static int __init arch_timer_mem_acpi_init(int platform_timer_count) * While unlikely, it's theoretically possible that none of the frames * in a timer expose the combination of feature we want. */ - for (i = i; i < timer_count; i++) { + for (i = 0; i < timer_count; i++) { timer = &timers[i]; frame = arch_timer_mem_find_best_frame(timer); -- 2.14.0.rc0.400.g1c36432dff-goog ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] clocksource: arm_arch_timer: Fix mem frame loop initialization 2017-07-31 18:37 ` Matthias Kaehlcke @ 2017-08-01 11:12 ` Mark Rutland -1 siblings, 0 replies; 6+ messages in thread From: Mark Rutland @ 2017-08-01 11:12 UTC (permalink / raw) To: linux-arm-kernel On Mon, Jul 31, 2017 at 11:37:28AM -0700, Matthias Kaehlcke wrote: > The loop to find the best memory frame in arch_timer_mem_acpi_init() > initializes the loop counter with itself ('i = i'), which is suspicious > in the first place and pointed out by clang. The loop condition is > 'i < timer_count' and a prior for loop exits when 'i' reaches > 'timer_count', therefore the second loop is never executed. > > Initialize the loop counter with 0 to iterate over all timers, which > supposedly was the intention before the typo monster attacked. > > Fixes: c2743a36765d3 ("clocksource: arm_arch_timer: add GTDT support for memory-mapped timer") > Signed-off-by: Matthias Kaehlcke <mka@chromium.org> Ard also spotted this issue [1], along with another issue we still need to solve. In the mean time it would be nice to have this fixed, so: Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Mark Rutland <mark.rutland@arm.com> Daniel, Thomas, Could one of you please pick this up as a fix, with the above tags? Thanks, Mark. [1] http://lists.infradead.org/pipermail/linux-arm-kernel/2017-July/520779.html > --- > drivers/clocksource/arm_arch_timer.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c > index aae87c4c546e..72bbfccef113 100644 > --- a/drivers/clocksource/arm_arch_timer.c > +++ b/drivers/clocksource/arm_arch_timer.c > @@ -1440,7 +1440,7 @@ static int __init arch_timer_mem_acpi_init(int platform_timer_count) > * While unlikely, it's theoretically possible that none of the frames > * in a timer expose the combination of feature we want. > */ > - for (i = i; i < timer_count; i++) { > + for (i = 0; i < timer_count; i++) { > timer = &timers[i]; > > frame = arch_timer_mem_find_best_frame(timer); > -- > 2.14.0.rc0.400.g1c36432dff-goog > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] clocksource: arm_arch_timer: Fix mem frame loop initialization @ 2017-08-01 11:12 ` Mark Rutland 0 siblings, 0 replies; 6+ messages in thread From: Mark Rutland @ 2017-08-01 11:12 UTC (permalink / raw) To: Matthias Kaehlcke, Daniel Lezcano, Thomas Gleixner Cc: Fu Wei, Marc Zyngier, linux-kernel, linux-arm-kernel, Doug Anderson, ard.biesheuvel On Mon, Jul 31, 2017 at 11:37:28AM -0700, Matthias Kaehlcke wrote: > The loop to find the best memory frame in arch_timer_mem_acpi_init() > initializes the loop counter with itself ('i = i'), which is suspicious > in the first place and pointed out by clang. The loop condition is > 'i < timer_count' and a prior for loop exits when 'i' reaches > 'timer_count', therefore the second loop is never executed. > > Initialize the loop counter with 0 to iterate over all timers, which > supposedly was the intention before the typo monster attacked. > > Fixes: c2743a36765d3 ("clocksource: arm_arch_timer: add GTDT support for memory-mapped timer") > Signed-off-by: Matthias Kaehlcke <mka@chromium.org> Ard also spotted this issue [1], along with another issue we still need to solve. In the mean time it would be nice to have this fixed, so: Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Mark Rutland <mark.rutland@arm.com> Daniel, Thomas, Could one of you please pick this up as a fix, with the above tags? Thanks, Mark. [1] http://lists.infradead.org/pipermail/linux-arm-kernel/2017-July/520779.html > --- > drivers/clocksource/arm_arch_timer.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c > index aae87c4c546e..72bbfccef113 100644 > --- a/drivers/clocksource/arm_arch_timer.c > +++ b/drivers/clocksource/arm_arch_timer.c > @@ -1440,7 +1440,7 @@ static int __init arch_timer_mem_acpi_init(int platform_timer_count) > * While unlikely, it's theoretically possible that none of the frames > * in a timer expose the combination of feature we want. > */ > - for (i = i; i < timer_count; i++) { > + for (i = 0; i < timer_count; i++) { > timer = &timers[i]; > > frame = arch_timer_mem_find_best_frame(timer); > -- > 2.14.0.rc0.400.g1c36432dff-goog > ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] clocksource: arm_arch_timer: Fix mem frame loop initialization 2017-08-01 11:12 ` Mark Rutland @ 2017-08-01 11:34 ` Daniel Lezcano -1 siblings, 0 replies; 6+ messages in thread From: Daniel Lezcano @ 2017-08-01 11:34 UTC (permalink / raw) To: linux-arm-kernel On Tue, Aug 01, 2017 at 12:12:23PM +0100, Mark Rutland wrote: > On Mon, Jul 31, 2017 at 11:37:28AM -0700, Matthias Kaehlcke wrote: > > The loop to find the best memory frame in arch_timer_mem_acpi_init() > > initializes the loop counter with itself ('i = i'), which is suspicious > > in the first place and pointed out by clang. The loop condition is > > 'i < timer_count' and a prior for loop exits when 'i' reaches > > 'timer_count', therefore the second loop is never executed. > > > > Initialize the loop counter with 0 to iterate over all timers, which > > supposedly was the intention before the typo monster attacked. > > > > Fixes: c2743a36765d3 ("clocksource: arm_arch_timer: add GTDT support for memory-mapped timer") > > Signed-off-by: Matthias Kaehlcke <mka@chromium.org> > > Ard also spotted this issue [1], along with another issue we still need > to solve. In the mean time it would be nice to have this fixed, so: > > Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> > Acked-by: Mark Rutland <mark.rutland@arm.com> > > Daniel, Thomas, > > Could one of you please pick this up as a fix, with the above tags? Hi Mark, picked as a fix with the above tags. Thanks. -- Daniel ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] clocksource: arm_arch_timer: Fix mem frame loop initialization @ 2017-08-01 11:34 ` Daniel Lezcano 0 siblings, 0 replies; 6+ messages in thread From: Daniel Lezcano @ 2017-08-01 11:34 UTC (permalink / raw) To: Mark Rutland Cc: Matthias Kaehlcke, Thomas Gleixner, Fu Wei, Marc Zyngier, linux-kernel, linux-arm-kernel, Doug Anderson, ard.biesheuvel On Tue, Aug 01, 2017 at 12:12:23PM +0100, Mark Rutland wrote: > On Mon, Jul 31, 2017 at 11:37:28AM -0700, Matthias Kaehlcke wrote: > > The loop to find the best memory frame in arch_timer_mem_acpi_init() > > initializes the loop counter with itself ('i = i'), which is suspicious > > in the first place and pointed out by clang. The loop condition is > > 'i < timer_count' and a prior for loop exits when 'i' reaches > > 'timer_count', therefore the second loop is never executed. > > > > Initialize the loop counter with 0 to iterate over all timers, which > > supposedly was the intention before the typo monster attacked. > > > > Fixes: c2743a36765d3 ("clocksource: arm_arch_timer: add GTDT support for memory-mapped timer") > > Signed-off-by: Matthias Kaehlcke <mka@chromium.org> > > Ard also spotted this issue [1], along with another issue we still need > to solve. In the mean time it would be nice to have this fixed, so: > > Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> > Acked-by: Mark Rutland <mark.rutland@arm.com> > > Daniel, Thomas, > > Could one of you please pick this up as a fix, with the above tags? Hi Mark, picked as a fix with the above tags. Thanks. -- Daniel ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-08-01 11:34 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-07-31 18:37 [PATCH] clocksource: arm_arch_timer: Fix mem frame loop initialization Matthias Kaehlcke 2017-07-31 18:37 ` Matthias Kaehlcke 2017-08-01 11:12 ` Mark Rutland 2017-08-01 11:12 ` Mark Rutland 2017-08-01 11:34 ` Daniel Lezcano 2017-08-01 11:34 ` Daniel Lezcano
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.