Mismatch between index for gpt clocks will result in writting
out of bounds into dsp clock timer array when requesting gpt8,
for the other gpt the bogus code is being masked as it falls
within the array's range.

Discovered-by: Ernesto Ramos Falcon <[email protected]>
Signed-off-by: Omar Ramirez Luna <[email protected]>
---
 drivers/dsp/bridge/core/dsp-clock.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/dsp/bridge/core/dsp-clock.c 
b/drivers/dsp/bridge/core/dsp-clock.c
index 4613de9..dba0535 100644
--- a/drivers/dsp/bridge/core/dsp-clock.c
+++ b/drivers/dsp/bridge/core/dsp-clock.c
@@ -212,7 +212,8 @@ int dsp_clk_enable(IN enum dsp_clk_id clk_id)
                clk_enable(iva2_clk);
                break;
        case GPT_CLK:
-               timer[clk_id] = omap_dm_timer_request_specific(DMT_ID(clk_id));
+               timer[clk_id - 1] =
+                               omap_dm_timer_request_specific(DMT_ID(clk_id));
                break;
        case MCBSP_CLK:
                mcbsp_clk_prepare(true, clk_id);
@@ -287,7 +288,7 @@ int dsp_clk_disable(IN enum dsp_clk_id clk_id)
                clk_disable(iva2_clk);
                break;
        case GPT_CLK:
-               omap_dm_timer_free(timer[clk_id]);
+               omap_dm_timer_free(timer[clk_id - 1]);
                break;
        case MCBSP_CLK:
                mcbsp_clk_prepare(false, clk_id);
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to