From 45f8a9d5372c21f437598b73b9d035ea7fa65105 Mon Sep 17 00:00:00 2001 From: Achal Verma Date: Thu, 19 Mar 2020 23:49:29 +0530 Subject: thermal: fix 'out of bound access' correct range in for loop as per the static array size. This fixes coverity issues:9848167,9848011 Bug 2028892 Change-Id: I164967283ba4530fa66c6038d607dba0e2401152 Signed-off-by: Achal Verma Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2315581 Reviewed-by: automaticguardword Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Dmitry Pervushin Reviewed-by: Phoenix Jung Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- drivers/misc/therm_fan_est.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/therm_fan_est.c b/drivers/misc/therm_fan_est.c index 39366c80b..f07a31009 100644 --- a/drivers/misc/therm_fan_est.c +++ b/drivers/misc/therm_fan_est.c @@ -1,7 +1,7 @@ /* * drivers/misc/therm_fan_est.c * - * Copyright (c) 2013-2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2013-2020, NVIDIA CORPORATION. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and @@ -112,7 +112,7 @@ static void therm_fan_est_work_func(struct work_struct *work) /* temperature is cooling */ read_lock(&est->state_lock); for (trip_index = 1; - trip_index < (MAX_ACTIVE_STATES + 1); trip_index++) { + trip_index < MAX_ACTIVE_STATES; trip_index++) { if (est->cur_temp < (est->active_trip_temps[trip_index] - est->active_hysteresis[trip_index])) break; -- cgit v1.2.2