clk: at91: fix count of periph clocks passed to pmc_data_allocate
Subsystems (2)
PATCH 1/1 clk: at91: fix count of periph clocks passed to pmc_data_allocate
When allocating clk_hw structure, only the periph32 clocks are considered. Since sama5d2_periphck are also added to the phws there is currently an out of bound write. Fix this by adding the count of periphck to periph32ck.
--- drivers/clk/at91/sama5d2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/at91/sama5d2.c +1 -1
@@ -170,7 +170,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np) sama5d2_pmc =pmc_data_allocate (PMC_AUDIOPLLCK +1 ,nck (sama5d2_systemck), -nck (sama5d2_periph32ck), +nck (sama5d2_periphck) +nck (sama5d2_periph32ck),nck (sama5d2_gck),3 );if (!sama5d2_pmc)return ;
Signature · 1 line
2.32.0
Alexandre Belloni
maintainerhi,
Subject should have been:
clk: at91: sama5d2: fix count of periph clocks passed to pmc_data_allocate
Quoted 5 lines · Clément Léger
When allocating
clk_hwstructure, only the periph32 clocks are considered. Sincesama5d2_periphckare also added to the phws there is currently an out of bound write. Fix this by adding the count of periphck to periph32ck.Signed-off-by Clément Léger <[email protected]>
Quoted 20 lines
--- drivers/clk/at91/sama5d2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/clk/at91/sama5d2.c +1
-1@@ -170,7 +170,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np) sama5d2_pmc =pmc_data_allocate (PMC_AUDIOPLLCK +1 ,nck (sama5d2_systemck), -nck (sama5d2_periph32ck), +nck (sama5d2_periphck) +nck (sama5d2_periph32ck),nck (sama5d2_gck),3 );if (!sama5d2_pmc)return ;Signature · 1 line
2.32.0
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Hi,
Quoted 6 lines · Alexandre Belloni
hi,
Subject should have been:
clk: at91: sama5d2: fix count of periph clocks passed topmc_data_allocate
This patch can actually be discarded since it won't fix allocation at all but will just allocate more data than needed since nck already returns the max .id field of the periph array.
Quoted 15 lines · Clément Léger
Quoted 6 lines
When allocating
clk_hwstructure, only the periph32 clocks are considered. Sincesama5d2_periphckare also added to the phws there is currently an out of bound write. Fix this by adding the count of periphck to periph32ck.Signed-off-by Clément Léger <[email protected]>Fixes a2038077de9a ("clk: at91: add sama5d2 PMC driver")Quoted 4 lines
--- drivers/clk/at91/sama5d2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 17 lines
Quoted 16 lines
drivers/clk/at91/sama5d2.c +1
-1@@ -170,7 +170,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np) sama5d2_pmc =pmc_data_allocate (PMC_AUDIOPLLCK +1 ,nck (sama5d2_systemck), -nck (sama5d2_periph32ck), +nck (sama5d2_periphck) +nck (sama5d2_periph32ck),nck (sama5d2_gck),3 );if (!sama5d2_pmc)return ;Signature · 1 line
2.32.0
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel