[PATCH v2] cpufreq: qcom-nvmem: add sentinel to qcom_cpufreq_ipq806x_match_list

xiaopeitux@foxmail.com posted 1 patch 2 weeks, 3 days ago
drivers/cpufreq/qcom-cpufreq-nvmem.c | 1 +
1 file changed, 1 insertion(+)
[PATCH v2] cpufreq: qcom-nvmem: add sentinel to qcom_cpufreq_ipq806x_match_list
Posted by xiaopeitux@foxmail.com 2 weeks, 3 days ago
From: Pei Xiao <xiaopei01@kylinos.cn>

The of_device_id table is expected to be NULL-terminated. Without the
sentinel, the traversal of the array can lead to out-of-bound access,
causing undefined behavior.

This adds the missing sentinel to the qcom_cpufreq_ipq806x_match_list
array.

Fixes: 58f5d39d5ed8 ("cpufreq: qcom-nvmem: add compatible fallback for ipq806x for no SMEM")
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
---
changlog in v2:
Remove the extra commas
---
 drivers/cpufreq/qcom-cpufreq-nvmem.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
index 81e16b5a0245..b8081acba928 100644
--- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
+++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
@@ -263,6 +263,7 @@ static const struct of_device_id qcom_cpufreq_ipq806x_match_list[] __maybe_unuse
 	{ .compatible = "qcom,ipq8066", .data = (const void *)QCOM_ID_IPQ8066 },
 	{ .compatible = "qcom,ipq8068", .data = (const void *)QCOM_ID_IPQ8068 },
 	{ .compatible = "qcom,ipq8069", .data = (const void *)QCOM_ID_IPQ8069 },
+	{ /* sentinel */ }
 };
 
 static int qcom_cpufreq_ipq8064_name_version(struct device *cpu_dev,
-- 
2.25.1
Re: [PATCH v2] cpufreq: qcom-nvmem: add sentinel to qcom_cpufreq_ipq806x_match_list
Posted by Konrad Dybcio 2 weeks, 2 days ago
On 1/22/26 2:44 AM, xiaopeitux@foxmail.com wrote:
> From: Pei Xiao <xiaopei01@kylinos.cn>
> 
> The of_device_id table is expected to be NULL-terminated. Without the
> sentinel, the traversal of the array can lead to out-of-bound access,
> causing undefined behavior.
> 
> This adds the missing sentinel to the qcom_cpufreq_ipq806x_match_list
> array.
> 
> Fixes: 58f5d39d5ed8 ("cpufreq: qcom-nvmem: add compatible fallback for ipq806x for no SMEM")
> Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
> ---
> changlog in v2:
> Remove the extra commas
> ---

Thanks for catching that

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad
Re: [PATCH v2] cpufreq: qcom-nvmem: add sentinel to qcom_cpufreq_ipq806x_match_list
Posted by Viresh Kumar 2 weeks, 2 days ago
On 22-01-26, 09:44, xiaopeitux@foxmail.com wrote:
> From: Pei Xiao <xiaopei01@kylinos.cn>
> 
> The of_device_id table is expected to be NULL-terminated. Without the
> sentinel, the traversal of the array can lead to out-of-bound access,
> causing undefined behavior.
> 
> This adds the missing sentinel to the qcom_cpufreq_ipq806x_match_list
> array.
> 
> Fixes: 58f5d39d5ed8 ("cpufreq: qcom-nvmem: add compatible fallback for ipq806x for no SMEM")
> Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
> ---
> changlog in v2:
> Remove the extra commas
> ---
>  drivers/cpufreq/qcom-cpufreq-nvmem.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/cpufreq/qcom-cpufreq-nvmem.c b/drivers/cpufreq/qcom-cpufreq-nvmem.c
> index 81e16b5a0245..b8081acba928 100644
> --- a/drivers/cpufreq/qcom-cpufreq-nvmem.c
> +++ b/drivers/cpufreq/qcom-cpufreq-nvmem.c
> @@ -263,6 +263,7 @@ static const struct of_device_id qcom_cpufreq_ipq806x_match_list[] __maybe_unuse
>  	{ .compatible = "qcom,ipq8066", .data = (const void *)QCOM_ID_IPQ8066 },
>  	{ .compatible = "qcom,ipq8068", .data = (const void *)QCOM_ID_IPQ8068 },
>  	{ .compatible = "qcom,ipq8069", .data = (const void *)QCOM_ID_IPQ8069 },
> +	{ /* sentinel */ }
>  };
>  
>  static int qcom_cpufreq_ipq8064_name_version(struct device *cpu_dev,

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Rafael, can you take this directly for rc7 ?

-- 
viresh