2024-02-29 18:08:33

by Gabor Juhos

[permalink] [raw]
Subject: [PATCH 0/7] clk: qcom: fix frequency table termination in several drivers

Add missing terminating entry to frequency table arrays in
several drivers. There are separate independent patches for
each affected driver.

The series is based on v6.8-rc6.

Signed-off-by: Gabor Juhos <[email protected]>
---
Gabor Juhos (7):
clk: qcom: gcc-ipq5018: fix terminating of frequency table arrays
clk: qcom: gcc-ipq6018: fix terminating of frequency table arrays
clk: qcom: gcc-ipq8074: fix terminating of frequency table arrays
clk: qcom: gcc-ipq9574: fix terminating of frequency table arrays
clk: qcom: camcc-sc8280xp: fix terminating of frequency table arrays
clk: qcom: mmcc-apq8084: fix terminating of frequency table arrays
clk: qcom: mmcc-msm8974: fix terminating of frequency table arrays

drivers/clk/qcom/camcc-sc8280xp.c | 21 +++++++++++++++++++++
drivers/clk/qcom/gcc-ipq5018.c | 3 +++
drivers/clk/qcom/gcc-ipq6018.c | 2 ++
drivers/clk/qcom/gcc-ipq8074.c | 2 ++
drivers/clk/qcom/gcc-ipq9574.c | 1 +
drivers/clk/qcom/mmcc-apq8084.c | 2 ++
drivers/clk/qcom/mmcc-msm8974.c | 2 ++
7 files changed, 33 insertions(+)
---
base-commit: d206a76d7d2726f3b096037f2079ce0bd3ba329b
change-id: 20240223-freq-table-terminator-f78760e7b5e0

Best regards,
--
Gabor Juhos <[email protected]>



2024-02-29 18:08:42

by Gabor Juhos

[permalink] [raw]
Subject: [PATCH 1/7] clk: qcom: gcc-ipq5018: fix terminating of frequency table arrays

The frequency table arrays are supposed to be terminated with an
empty element. Add such entry to the end of the arrays where it
is missing in order to avoid possible out-of-bound access when
the table is traversed by functions like qcom_find_freq() or
qcom_find_freq_floor().

Fixes: e3fdbef1bab8 ("clk: qcom: Add Global Clock controller (GCC) driver for IPQ5018")
Signed-off-by: Gabor Juhos <[email protected]>
---
drivers/clk/qcom/gcc-ipq5018.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/clk/qcom/gcc-ipq5018.c b/drivers/clk/qcom/gcc-ipq5018.c
index 4aba47e8700d2..856a2b30e2a8e 100644
--- a/drivers/clk/qcom/gcc-ipq5018.c
+++ b/drivers/clk/qcom/gcc-ipq5018.c
@@ -857,6 +857,7 @@ static struct clk_rcg2 lpass_sway_clk_src = {

static const struct freq_tbl ftbl_pcie0_aux_clk_src[] = {
F(2000000, P_XO, 12, 0, 0),
+ { }
};

static struct clk_rcg2 pcie0_aux_clk_src = {
@@ -1099,6 +1100,7 @@ static const struct freq_tbl ftbl_qpic_io_macro_clk_src[] = {
F(100000000, P_GPLL0, 8, 0, 0),
F(200000000, P_GPLL0, 4, 0, 0),
F(320000000, P_GPLL0, 2.5, 0, 0),
+ { }
};

static struct clk_rcg2 qpic_io_macro_clk_src = {
@@ -1194,6 +1196,7 @@ static struct clk_rcg2 ubi0_axi_clk_src = {
static const struct freq_tbl ftbl_ubi0_core_clk_src[] = {
F(850000000, P_UBI32_PLL, 1, 0, 0),
F(1000000000, P_UBI32_PLL, 1, 0, 0),
+ { }
};

static struct clk_rcg2 ubi0_core_clk_src = {

--
2.44.0


2024-02-29 18:08:58

by Gabor Juhos

[permalink] [raw]
Subject: [PATCH 2/7] clk: qcom: gcc-ipq6018: fix terminating of frequency table arrays

The frequency table arrays are supposed to be terminated with an
empty element. Add such entry to the end of the arrays where it
is missing in order to avoid possible out-of-bound access when
the table is traversed by functions like qcom_find_freq() or
qcom_find_freq_floor().

Only compile tested.

Fixes: d9db07f088af ("clk: qcom: Add ipq6018 Global Clock Controller support")
Signed-off-by: Gabor Juhos <[email protected]>
---
drivers/clk/qcom/gcc-ipq6018.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/clk/qcom/gcc-ipq6018.c b/drivers/clk/qcom/gcc-ipq6018.c
index b366912cd6480..ef1e2ce4804d2 100644
--- a/drivers/clk/qcom/gcc-ipq6018.c
+++ b/drivers/clk/qcom/gcc-ipq6018.c
@@ -1554,6 +1554,7 @@ static struct clk_regmap_div nss_ubi0_div_clk_src = {

static const struct freq_tbl ftbl_pcie_aux_clk_src[] = {
F(24000000, P_XO, 1, 0, 0),
+ { }
};

static const struct clk_parent_data gcc_xo_gpll0_core_pi_sleep_clk[] = {
@@ -1734,6 +1735,7 @@ static const struct freq_tbl ftbl_sdcc_ice_core_clk_src[] = {
F(160000000, P_GPLL0, 5, 0, 0),
F(216000000, P_GPLL6, 5, 0, 0),
F(308570000, P_GPLL6, 3.5, 0, 0),
+ { }
};

static const struct clk_parent_data gcc_xo_gpll0_gpll6_gpll0_div2[] = {

--
2.44.0


2024-02-29 18:09:14

by Gabor Juhos

[permalink] [raw]
Subject: [PATCH 3/7] clk: qcom: gcc-ipq8074: fix terminating of frequency table arrays

The frequency table arrays are supposed to be terminated with an
empty element. Add such entry to the end of the arrays where it
is missing in order to avoid possible out-of-bound access when
the table is traversed by functions like qcom_find_freq() or
qcom_find_freq_floor().

Only compile tested.

Fixes: 9607f6224b39 ("clk: qcom: ipq8074: add PCIE, USB and SDCC clocks")
Signed-off-by: Gabor Juhos <[email protected]>
---
drivers/clk/qcom/gcc-ipq8074.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/clk/qcom/gcc-ipq8074.c b/drivers/clk/qcom/gcc-ipq8074.c
index b7faf12a511a1..7bc679871f324 100644
--- a/drivers/clk/qcom/gcc-ipq8074.c
+++ b/drivers/clk/qcom/gcc-ipq8074.c
@@ -644,6 +644,7 @@ static struct clk_rcg2 pcie0_axi_clk_src = {

static const struct freq_tbl ftbl_pcie_aux_clk_src[] = {
F(19200000, P_XO, 1, 0, 0),
+ { }
};

static const struct clk_parent_data gcc_xo_gpll0_sleep_clk[] = {
@@ -795,6 +796,7 @@ static const struct freq_tbl ftbl_sdcc_ice_core_clk_src[] = {
F(19200000, P_XO, 1, 0, 0),
F(160000000, P_GPLL0, 5, 0, 0),
F(308570000, P_GPLL6, 3.5, 0, 0),
+ { }
};

static const struct clk_parent_data gcc_xo_gpll0_gpll6_gpll0_div2[] = {

--
2.44.0


2024-02-29 18:09:45

by Gabor Juhos

[permalink] [raw]
Subject: [PATCH 5/7] clk: qcom: camcc-sc8280xp: fix terminating of frequency table arrays

The frequency table arrays are supposed to be terminated with an
empty element. Add such entry to the end of the arrays where it
is missing in order to avoid possible out-of-bound access when
the table is traversed by functions like qcom_find_freq() or
qcom_find_freq_floor().

Only compile tested.

Fixes: ff93872a9c61 ("clk: qcom: camcc-sc8280xp: Add sc8280xp CAMCC")
Signed-off-by: Gabor Juhos <[email protected]>
---
drivers/clk/qcom/camcc-sc8280xp.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)

diff --git a/drivers/clk/qcom/camcc-sc8280xp.c b/drivers/clk/qcom/camcc-sc8280xp.c
index 3dcd79b015151..7f0ae9a5f28b2 100644
--- a/drivers/clk/qcom/camcc-sc8280xp.c
+++ b/drivers/clk/qcom/camcc-sc8280xp.c
@@ -630,6 +630,7 @@ static const struct freq_tbl ftbl_camcc_bps_clk_src[] = {
F(480000000, P_CAMCC_PLL7_OUT_EVEN, 1, 0, 0),
F(600000000, P_CAMCC_PLL0_OUT_MAIN, 2, 0, 0),
F(760000000, P_CAMCC_PLL3_OUT_EVEN, 1, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_bps_clk_src = {
@@ -654,6 +655,7 @@ static const struct freq_tbl ftbl_camcc_camnoc_axi_clk_src[] = {
F(320000000, P_CAMCC_PLL7_OUT_ODD, 1, 0, 0),
F(400000000, P_CAMCC_PLL0_OUT_ODD, 1, 0, 0),
F(480000000, P_CAMCC_PLL7_OUT_EVEN, 1, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_camnoc_axi_clk_src = {
@@ -673,6 +675,7 @@ static struct clk_rcg2 camcc_camnoc_axi_clk_src = {
static const struct freq_tbl ftbl_camcc_cci_0_clk_src[] = {
F(19200000, P_BI_TCXO, 1, 0, 0),
F(37500000, P_CAMCC_PLL0_OUT_EVEN, 16, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_cci_0_clk_src = {
@@ -735,6 +738,7 @@ static const struct freq_tbl ftbl_camcc_cphy_rx_clk_src[] = {
F(19200000, P_BI_TCXO, 1, 0, 0),
F(240000000, P_CAMCC_PLL0_OUT_EVEN, 2.5, 0, 0),
F(400000000, P_CAMCC_PLL0_OUT_ODD, 1, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_cphy_rx_clk_src = {
@@ -754,6 +758,7 @@ static struct clk_rcg2 camcc_cphy_rx_clk_src = {
static const struct freq_tbl ftbl_camcc_csi0phytimer_clk_src[] = {
F(19200000, P_BI_TCXO, 1, 0, 0),
F(300000000, P_CAMCC_PLL0_OUT_EVEN, 2, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_csi0phytimer_clk_src = {
@@ -818,6 +823,7 @@ static const struct freq_tbl ftbl_camcc_fast_ahb_clk_src[] = {
F(200000000, P_CAMCC_PLL0_OUT_EVEN, 3, 0, 0),
F(300000000, P_CAMCC_PLL0_OUT_MAIN, 4, 0, 0),
F(400000000, P_CAMCC_PLL0_OUT_MAIN, 3, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_fast_ahb_clk_src = {
@@ -838,6 +844,7 @@ static const struct freq_tbl ftbl_camcc_icp_clk_src[] = {
F(19200000, P_BI_TCXO, 1, 0, 0),
F(400000000, P_CAMCC_PLL0_OUT_ODD, 1, 0, 0),
F(600000000, P_CAMCC_PLL0_OUT_MAIN, 2, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_icp_clk_src = {
@@ -860,6 +867,7 @@ static const struct freq_tbl ftbl_camcc_ife_0_clk_src[] = {
F(558000000, P_CAMCC_PLL3_OUT_EVEN, 1, 0, 0),
F(637000000, P_CAMCC_PLL3_OUT_EVEN, 1, 0, 0),
F(760000000, P_CAMCC_PLL3_OUT_EVEN, 1, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_ife_0_clk_src = {
@@ -883,6 +891,7 @@ static const struct freq_tbl ftbl_camcc_ife_0_csid_clk_src[] = {
F(400000000, P_CAMCC_PLL0_OUT_ODD, 1, 0, 0),
F(480000000, P_CAMCC_PLL7_OUT_EVEN, 1, 0, 0),
F(600000000, P_CAMCC_PLL0_OUT_MAIN, 2, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_ife_0_csid_clk_src = {
@@ -905,6 +914,7 @@ static const struct freq_tbl ftbl_camcc_ife_1_clk_src[] = {
F(558000000, P_CAMCC_PLL4_OUT_EVEN, 1, 0, 0),
F(637000000, P_CAMCC_PLL4_OUT_EVEN, 1, 0, 0),
F(760000000, P_CAMCC_PLL4_OUT_EVEN, 1, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_ife_1_clk_src = {
@@ -941,6 +951,7 @@ static const struct freq_tbl ftbl_camcc_ife_2_clk_src[] = {
F(558000000, P_CAMCC_PLL5_OUT_EVEN, 1, 0, 0),
F(637000000, P_CAMCC_PLL5_OUT_EVEN, 1, 0, 0),
F(760000000, P_CAMCC_PLL5_OUT_EVEN, 1, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_ife_2_clk_src = {
@@ -962,6 +973,7 @@ static const struct freq_tbl ftbl_camcc_ife_2_csid_clk_src[] = {
F(400000000, P_CAMCC_PLL0_OUT_ODD, 1, 0, 0),
F(480000000, P_CAMCC_PLL7_OUT_EVEN, 1, 0, 0),
F(600000000, P_CAMCC_PLL0_OUT_MAIN, 2, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_ife_2_csid_clk_src = {
@@ -984,6 +996,7 @@ static const struct freq_tbl ftbl_camcc_ife_3_clk_src[] = {
F(558000000, P_CAMCC_PLL6_OUT_EVEN, 1, 0, 0),
F(637000000, P_CAMCC_PLL6_OUT_EVEN, 1, 0, 0),
F(760000000, P_CAMCC_PLL6_OUT_EVEN, 1, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_ife_3_clk_src = {
@@ -1020,6 +1033,7 @@ static const struct freq_tbl ftbl_camcc_ife_lite_0_clk_src[] = {
F(400000000, P_CAMCC_PLL0_OUT_ODD, 1, 0, 0),
F(480000000, P_CAMCC_PLL7_OUT_EVEN, 1, 0, 0),
F(600000000, P_CAMCC_PLL0_OUT_MAIN, 2, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_ife_lite_0_clk_src = {
@@ -1140,6 +1154,7 @@ static const struct freq_tbl ftbl_camcc_ipe_0_clk_src[] = {
F(475000000, P_CAMCC_PLL1_OUT_EVEN, 1, 0, 0),
F(520000000, P_CAMCC_PLL1_OUT_EVEN, 1, 0, 0),
F(600000000, P_CAMCC_PLL1_OUT_EVEN, 1, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_ipe_0_clk_src = {
@@ -1163,6 +1178,7 @@ static const struct freq_tbl ftbl_camcc_jpeg_clk_src[] = {
F(400000000, P_CAMCC_PLL0_OUT_ODD, 1, 0, 0),
F(480000000, P_CAMCC_PLL7_OUT_EVEN, 1, 0, 0),
F(600000000, P_CAMCC_PLL0_OUT_MAIN, 2, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_jpeg_clk_src = {
@@ -1184,6 +1200,7 @@ static const struct freq_tbl ftbl_camcc_lrme_clk_src[] = {
F(300000000, P_CAMCC_PLL0_OUT_EVEN, 2, 0, 0),
F(320000000, P_CAMCC_PLL7_OUT_ODD, 1, 0, 0),
F(400000000, P_CAMCC_PLL0_OUT_MAIN, 3, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_lrme_clk_src = {
@@ -1204,6 +1221,7 @@ static const struct freq_tbl ftbl_camcc_mclk0_clk_src[] = {
F(19200000, P_BI_TCXO, 1, 0, 0),
F(24000000, P_CAMCC_PLL2_OUT_EARLY, 10, 1, 4),
F(64000000, P_CAMCC_PLL2_OUT_EARLY, 15, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_mclk0_clk_src = {
@@ -1320,6 +1338,7 @@ static struct clk_rcg2 camcc_mclk7_clk_src = {

static const struct freq_tbl ftbl_camcc_sleep_clk_src[] = {
F(32000, P_SLEEP_CLK, 1, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_sleep_clk_src = {
@@ -1339,6 +1358,7 @@ static struct clk_rcg2 camcc_sleep_clk_src = {
static const struct freq_tbl ftbl_camcc_slow_ahb_clk_src[] = {
F(19200000, P_BI_TCXO, 1, 0, 0),
F(80000000, P_CAMCC_PLL7_OUT_EVEN, 6, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_slow_ahb_clk_src = {
@@ -1357,6 +1377,7 @@ static struct clk_rcg2 camcc_slow_ahb_clk_src = {

static const struct freq_tbl ftbl_camcc_xo_clk_src[] = {
F(19200000, P_BI_TCXO, 1, 0, 0),
+ { }
};

static struct clk_rcg2 camcc_xo_clk_src = {

--
2.44.0


2024-02-29 18:09:55

by Gabor Juhos

[permalink] [raw]
Subject: [PATCH 6/7] clk: qcom: mmcc-apq8084: fix terminating of frequency table arrays

The frequency table arrays are supposed to be terminated with an
empty element. Add such entry to the end of the arrays where it
is missing in order to avoid possible out-of-bound access when
the table is traversed by functions like qcom_find_freq() or
qcom_find_freq_floor().

Only compile tested.

Fixes: 2b46cd23a5a2 ("clk: qcom: Add APQ8084 Multimedia Clock Controller (MMCC) support")
Signed-off-by: Gabor Juhos <[email protected]>
---
drivers/clk/qcom/mmcc-apq8084.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/clk/qcom/mmcc-apq8084.c b/drivers/clk/qcom/mmcc-apq8084.c
index 02fc21208dd14..c89700ab93f9c 100644
--- a/drivers/clk/qcom/mmcc-apq8084.c
+++ b/drivers/clk/qcom/mmcc-apq8084.c
@@ -348,6 +348,7 @@ static struct freq_tbl ftbl_mmss_axi_clk[] = {
F(333430000, P_MMPLL1, 3.5, 0, 0),
F(400000000, P_MMPLL0, 2, 0, 0),
F(466800000, P_MMPLL1, 2.5, 0, 0),
+ { }
};

static struct clk_rcg2 mmss_axi_clk_src = {
@@ -372,6 +373,7 @@ static struct freq_tbl ftbl_ocmemnoc_clk[] = {
F(150000000, P_GPLL0, 4, 0, 0),
F(228570000, P_MMPLL0, 3.5, 0, 0),
F(320000000, P_MMPLL0, 2.5, 0, 0),
+ { }
};

static struct clk_rcg2 ocmemnoc_clk_src = {

--
2.44.0


2024-02-29 18:10:06

by Gabor Juhos

[permalink] [raw]
Subject: [PATCH 7/7] clk: qcom: mmcc-msm8974: fix terminating of frequency table arrays

The frequency table arrays are supposed to be terminated with an
empty element. Add such entry to the end of the arrays where it
is missing in order to avoid possible out-of-bound access when
the table is traversed by functions like qcom_find_freq() or
qcom_find_freq_floor().

Only compile tested.

Fixes: d8b212014e69 ("clk: qcom: Add support for MSM8974's multimedia clock controller (MMCC)")
Signed-off-by: Gabor Juhos <[email protected]>
---
drivers/clk/qcom/mmcc-msm8974.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/clk/qcom/mmcc-msm8974.c b/drivers/clk/qcom/mmcc-msm8974.c
index a31f6cf0c4e0c..36f460b78be2c 100644
--- a/drivers/clk/qcom/mmcc-msm8974.c
+++ b/drivers/clk/qcom/mmcc-msm8974.c
@@ -290,6 +290,7 @@ static struct freq_tbl ftbl_mmss_axi_clk[] = {
F(291750000, P_MMPLL1, 4, 0, 0),
F(400000000, P_MMPLL0, 2, 0, 0),
F(466800000, P_MMPLL1, 2.5, 0, 0),
+ { }
};

static struct clk_rcg2 mmss_axi_clk_src = {
@@ -314,6 +315,7 @@ static struct freq_tbl ftbl_ocmemnoc_clk[] = {
F(150000000, P_GPLL0, 4, 0, 0),
F(291750000, P_MMPLL1, 4, 0, 0),
F(400000000, P_MMPLL0, 2, 0, 0),
+ { }
};

static struct clk_rcg2 ocmemnoc_clk_src = {

--
2.44.0


2024-02-29 18:18:33

by Gabor Juhos

[permalink] [raw]
Subject: [PATCH 4/7] clk: qcom: gcc-ipq9574: fix terminating of frequency table arrays

The frequency table arrays are supposed to be terminated with an
empty element. Add such entry to the end of the arrays where it
is missing in order to avoid possible out-of-bound access when
the table is traversed by functions like qcom_find_freq() or
qcom_find_freq_floor().

Only compile tested.

Fixes: d75b82cff488 ("clk: qcom: Add Global Clock Controller driver for IPQ9574")
Signed-off-by: Gabor Juhos <[email protected]>
---
drivers/clk/qcom/gcc-ipq9574.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/clk/qcom/gcc-ipq9574.c b/drivers/clk/qcom/gcc-ipq9574.c
index e8190108e1aef..0a3f846695b80 100644
--- a/drivers/clk/qcom/gcc-ipq9574.c
+++ b/drivers/clk/qcom/gcc-ipq9574.c
@@ -2082,6 +2082,7 @@ static struct clk_branch gcc_sdcc1_apps_clk = {
static const struct freq_tbl ftbl_sdcc_ice_core_clk_src[] = {
F(150000000, P_GPLL4, 8, 0, 0),
F(300000000, P_GPLL4, 4, 0, 0),
+ { }
};

static struct clk_rcg2 sdcc1_ice_core_clk_src = {

--
2.44.0


2024-03-01 01:17:11

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 1/7] clk: qcom: gcc-ipq5018: fix terminating of frequency table arrays

Quoting Gabor Juhos (2024-02-29 10:07:46)
> The frequency table arrays are supposed to be terminated with an
> empty element. Add such entry to the end of the arrays where it
> is missing in order to avoid possible out-of-bound access when
> the table is traversed by functions like qcom_find_freq() or
> qcom_find_freq_floor().
>
> Fixes: e3fdbef1bab8 ("clk: qcom: Add Global Clock controller (GCC) driver for IPQ5018")
> Signed-off-by: Gabor Juhos <[email protected]>
> ---

Reviewed-by: Stephen Boyd <[email protected]>

2024-03-01 01:17:48

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 2/7] clk: qcom: gcc-ipq6018: fix terminating of frequency table arrays

Quoting Gabor Juhos (2024-02-29 10:07:47)
> The frequency table arrays are supposed to be terminated with an
> empty element. Add such entry to the end of the arrays where it
> is missing in order to avoid possible out-of-bound access when
> the table is traversed by functions like qcom_find_freq() or
> qcom_find_freq_floor().
>
> Only compile tested.
>
> Fixes: d9db07f088af ("clk: qcom: Add ipq6018 Global Clock Controller support")
> Signed-off-by: Gabor Juhos <[email protected]>
> ---

Reviewed-by: Stephen Boyd <[email protected]>

2024-03-01 01:18:33

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 3/7] clk: qcom: gcc-ipq8074: fix terminating of frequency table arrays

Quoting Gabor Juhos (2024-02-29 10:07:48)
> The frequency table arrays are supposed to be terminated with an
> empty element. Add such entry to the end of the arrays where it
> is missing in order to avoid possible out-of-bound access when
> the table is traversed by functions like qcom_find_freq() or
> qcom_find_freq_floor().
>
> Only compile tested.
>
> Fixes: 9607f6224b39 ("clk: qcom: ipq8074: add PCIE, USB and SDCC clocks")
> Signed-off-by: Gabor Juhos <[email protected]>
> ---

Reviewed-by: Stephen Boyd <[email protected]>

2024-03-01 01:18:44

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 4/7] clk: qcom: gcc-ipq9574: fix terminating of frequency table arrays

Quoting Gabor Juhos (2024-02-29 10:07:49)
> The frequency table arrays are supposed to be terminated with an
> empty element. Add such entry to the end of the arrays where it
> is missing in order to avoid possible out-of-bound access when
> the table is traversed by functions like qcom_find_freq() or
> qcom_find_freq_floor().
>
> Only compile tested.
>
> Fixes: d75b82cff488 ("clk: qcom: Add Global Clock Controller driver for IPQ9574")
> Signed-off-by: Gabor Juhos <[email protected]>
> ---

Reviewed-by: Stephen Boyd <[email protected]>

2024-03-01 01:19:28

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 5/7] clk: qcom: camcc-sc8280xp: fix terminating of frequency table arrays

Quoting Gabor Juhos (2024-02-29 10:07:50)
> The frequency table arrays are supposed to be terminated with an
> empty element. Add such entry to the end of the arrays where it
> is missing in order to avoid possible out-of-bound access when
> the table is traversed by functions like qcom_find_freq() or
> qcom_find_freq_floor().
>
> Only compile tested.
>
> Fixes: ff93872a9c61 ("clk: qcom: camcc-sc8280xp: Add sc8280xp CAMCC")
> Signed-off-by: Gabor Juhos <[email protected]>
> ---

Reviewed-by: Stephen Boyd <[email protected]>

2024-03-01 01:20:15

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 6/7] clk: qcom: mmcc-apq8084: fix terminating of frequency table arrays

Quoting Gabor Juhos (2024-02-29 10:07:51)
> The frequency table arrays are supposed to be terminated with an
> empty element. Add such entry to the end of the arrays where it
> is missing in order to avoid possible out-of-bound access when
> the table is traversed by functions like qcom_find_freq() or
> qcom_find_freq_floor().
>
> Only compile tested.
>
> Fixes: 2b46cd23a5a2 ("clk: qcom: Add APQ8084 Multimedia Clock Controller (MMCC) support")
> Signed-off-by: Gabor Juhos <[email protected]>
> ---

Reviewed-by: Stephen Boyd <[email protected]>

2024-03-01 01:20:55

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 7/7] clk: qcom: mmcc-msm8974: fix terminating of frequency table arrays

Quoting Gabor Juhos (2024-02-29 10:07:52)
> The frequency table arrays are supposed to be terminated with an
> empty element. Add such entry to the end of the arrays where it
> is missing in order to avoid possible out-of-bound access when
> the table is traversed by functions like qcom_find_freq() or
> qcom_find_freq_floor().
>
> Only compile tested.
>
> Fixes: d8b212014e69 ("clk: qcom: Add support for MSM8974's multimedia clock controller (MMCC)")
> Signed-off-by: Gabor Juhos <[email protected]>
> ---

Reviewed-by: Stephen Boyd <[email protected]>

2024-03-01 09:51:32

by Johan Hovold

[permalink] [raw]
Subject: Re: [PATCH 1/7] clk: qcom: gcc-ipq5018: fix terminating of frequency table arrays

On Thu, Feb 29, 2024 at 07:07:46PM +0100, Gabor Juhos wrote:
> The frequency table arrays are supposed to be terminated with an
> empty element. Add such entry to the end of the arrays where it
> is missing in order to avoid possible out-of-bound access when
> the table is traversed by functions like qcom_find_freq() or
> qcom_find_freq_floor().
>
> Fixes: e3fdbef1bab8 ("clk: qcom: Add Global Clock controller (GCC) driver for IPQ5018")

Good find!

Looks like these should be backported to the stable kernels as well so
someone should add:

Cc: [email protected]

to all patches except possibly the sc8280xp one (that camera clock
controller was added in 6.8-rc1 so that patch does not need it in case
you can these fixes in before 6.8 is released).

Johan

2024-03-01 13:37:25

by Gabor Juhos

[permalink] [raw]
Subject: Re: [PATCH 1/7] clk: qcom: gcc-ipq5018: fix terminating of frequency table arrays

Hi Johan,

2024. 03. 01. 10:40 keltezéssel, Johan Hovold írta:
> On Thu, Feb 29, 2024 at 07:07:46PM +0100, Gabor Juhos wrote:
>> The frequency table arrays are supposed to be terminated with an
>> empty element. Add such entry to the end of the arrays where it
>> is missing in order to avoid possible out-of-bound access when
>> the table is traversed by functions like qcom_find_freq() or
>> qcom_find_freq_floor().
>>
>> Fixes: e3fdbef1bab8 ("clk: qcom: Add Global Clock controller (GCC) driver for IPQ5018")
>
> Good find!
>
> Looks like these should be backported to the stable kernels as well so
> someone should add:
>
> Cc: [email protected]
>
> to all patches except possibly the sc8280xp one (that camera clock
> controller was added in 6.8-rc1 so that patch does not need it in case
> you can these fixes in before 6.8 is released).

You are right maybe, although I did not find strong enough reasons for adding
the stable tags.

Only the changes of the gcc-ipq5018 driver has been tested on real hardware the
others are not. So those does not fit into the "It must be obviously correct and
tested." rule.

Since the support for the IPQ5018 platform is quite incomplete as several
drivers are missing even in 6.8-rc6, it is quite unlikely that anyone uses a
stable kernel for something serious on such boards. Hence backporting the
gcc-ipq5018 changes would not help too much in itself.

Regards,
Gabor

2024-03-01 14:03:12

by Johan Hovold

[permalink] [raw]
Subject: Re: [PATCH 1/7] clk: qcom: gcc-ipq5018: fix terminating of frequency table arrays

On Fri, Mar 01, 2024 at 02:37:01PM +0100, Gabor Juhos wrote:
> Hi Johan,
>
> 2024. 03. 01. 10:40 keltezéssel, Johan Hovold írta:
> > On Thu, Feb 29, 2024 at 07:07:46PM +0100, Gabor Juhos wrote:
> >> The frequency table arrays are supposed to be terminated with an
> >> empty element. Add such entry to the end of the arrays where it
> >> is missing in order to avoid possible out-of-bound access when
> >> the table is traversed by functions like qcom_find_freq() or
> >> qcom_find_freq_floor().
> >>
> >> Fixes: e3fdbef1bab8 ("clk: qcom: Add Global Clock controller (GCC) driver for IPQ5018")
> >
> > Good find!
> >
> > Looks like these should be backported to the stable kernels as well so
> > someone should add:
> >
> > Cc: [email protected]
> >
> > to all patches except possibly the sc8280xp one (that camera clock
> > controller was added in 6.8-rc1 so that patch does not need it in case
> > you can these fixes in before 6.8 is released).
>
> You are right maybe, although I did not find strong enough reasons for adding
> the stable tags.
>
> Only the changes of the gcc-ipq5018 driver has been tested on real hardware the
> others are not. So those does not fit into the "It must be obviously correct and
> tested." rule.

Since this looks like a straight-forward and obviously correct fix for a
bug which could have bad consequences, not being able to test each patch
on actual hardware is not a problem.

Johan

2024-03-02 18:42:03

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH 1/7] clk: qcom: gcc-ipq5018: fix terminating of frequency table arrays

On Fri, Mar 01, 2024 at 03:03:15PM +0100, Johan Hovold wrote:
> On Fri, Mar 01, 2024 at 02:37:01PM +0100, Gabor Juhos wrote:
> > Hi Johan,
> >
> > 2024. 03. 01. 10:40 keltez?ssel, Johan Hovold ?rta:
> > > On Thu, Feb 29, 2024 at 07:07:46PM +0100, Gabor Juhos wrote:
> > >> The frequency table arrays are supposed to be terminated with an
> > >> empty element. Add such entry to the end of the arrays where it
> > >> is missing in order to avoid possible out-of-bound access when
> > >> the table is traversed by functions like qcom_find_freq() or
> > >> qcom_find_freq_floor().
> > >>
> > >> Fixes: e3fdbef1bab8 ("clk: qcom: Add Global Clock controller (GCC) driver for IPQ5018")
> > >
> > > Good find!
> > >
> > > Looks like these should be backported to the stable kernels as well so
> > > someone should add:
> > >
> > > Cc: [email protected]
> > >
> > > to all patches except possibly the sc8280xp one (that camera clock
> > > controller was added in 6.8-rc1 so that patch does not need it in case
> > > you can these fixes in before 6.8 is released).
> >
> > You are right maybe, although I did not find strong enough reasons for adding
> > the stable tags.
> >
> > Only the changes of the gcc-ipq5018 driver has been tested on real hardware the
> > others are not. So those does not fit into the "It must be obviously correct and
> > tested." rule.
>
> Since this looks like a straight-forward and obviously correct fix for a
> bug which could have bad consequences, not being able to test each patch
> on actual hardware is not a problem.
>

I agree, and I'm adding the Cc: stable while applying the patches.

Thanks,
Bjorn

2024-03-03 19:50:44

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH 0/7] clk: qcom: fix frequency table termination in several drivers


On Thu, 29 Feb 2024 19:07:45 +0100, Gabor Juhos wrote:
> Add missing terminating entry to frequency table arrays in
> several drivers. There are separate independent patches for
> each affected driver.
>
> The series is based on v6.8-rc6.
>
>
> [...]

Applied, thanks!

[1/7] clk: qcom: gcc-ipq5018: fix terminating of frequency table arrays
commit: 90ad946fff70f312b8d23226afc38c13ddd88c4b
[2/7] clk: qcom: gcc-ipq6018: fix terminating of frequency table arrays
commit: cdbc6e2d8108bc47895e5a901cfcaf799b00ca8d
[3/7] clk: qcom: gcc-ipq8074: fix terminating of frequency table arrays
commit: 1040ef5ed95d6fd2628bad387d78a61633e09429
[4/7] clk: qcom: gcc-ipq9574: fix terminating of frequency table arrays
commit: bd2b6395671d823caa38d8e4d752de2448ae61e1
[5/7] clk: qcom: camcc-sc8280xp: fix terminating of frequency table arrays
commit: 6a3d70f7802a98e6c28a74f997a264118b9f50cd
[6/7] clk: qcom: mmcc-apq8084: fix terminating of frequency table arrays
commit: a903cfd38d8dee7e754fb89fd1bebed99e28003d
[7/7] clk: qcom: mmcc-msm8974: fix terminating of frequency table arrays
commit: e2c02a85bf53ae86d79b5fccf0a75ac0b78e0c96

Best regards,
--
Bjorn Andersson <[email protected]>