From 5f1d941c510487603b5b7efd38fea57940b34496 Mon Sep 17 00:00:00 2001 From: Manaf Meethalavalappu Pallikunhi Date: Tue, 13 Oct 2020 11:45:05 +0530 Subject: [PATCH] drivers: thermal: cpu_voltage: initialize pointer variables before using it Initialize cpu freq table pointer to NULL while defining the same. It avoids a possible use of uninitialized value of this stack pointer in error path. Change-Id: If9fb6bfeb836d1f3c81ecd5d9910cf0c76b4a0c5 Signed-off-by: Manaf Meethalavalappu Pallikunhi --- drivers/thermal/qcom/cpu_voltage_cooling.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/qcom/cpu_voltage_cooling.c b/drivers/thermal/qcom/cpu_voltage_cooling.c index 44f3da1d987d..d0c235e5ce6d 100644 --- a/drivers/thermal/qcom/cpu_voltage_cooling.c +++ b/drivers/thermal/qcom/cpu_voltage_cooling.c @@ -177,8 +177,9 @@ static int build_unified_table(struct cc_limits_data *cc_cdev, static struct cc_limits_data *opp_init(int *cpus) { int cpu1, cpu2; - struct device *cpu1_dev, *cpu2_dev; - struct limits_freq_table *cpu1_freq_table, *cpu2_freq_table; + struct device *cpu1_dev = NULL, *cpu2_dev = NULL; + struct limits_freq_table *cpu1_freq_table = NULL; + struct limits_freq_table *cpu2_freq_table = NULL; struct limits_freq_table *cpu_freq_table[CPU_MAP_CT]; int table_ct[CPU_MAP_CT], ret = 0; struct cc_limits_data *cc_cdev = NULL;