summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAchal Verma <achalv@nvidia.com>2020-03-19 14:19:29 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2020-03-24 04:38:46 -0400
commit45f8a9d5372c21f437598b73b9d035ea7fa65105 (patch)
tree30184e7887245bfde979058ddef579c3ca57a983
parent27ffe7184031157ed13df306b83660679d8eb662 (diff)
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 <achalv@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2315581 Reviewed-by: automaticguardword <automaticguardword@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Dmitry Pervushin <dpervushin@nvidia.com> Reviewed-by: Phoenix Jung <pjung@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/misc/therm_fan_est.c4
1 files 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 @@
1/* 1/*
2 * drivers/misc/therm_fan_est.c 2 * drivers/misc/therm_fan_est.c
3 * 3 *
4 * Copyright (c) 2013-2019, NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2013-2020, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This software is licensed under the terms of the GNU General Public 6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and 7 * 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)
112 /* temperature is cooling */ 112 /* temperature is cooling */
113 read_lock(&est->state_lock); 113 read_lock(&est->state_lock);
114 for (trip_index = 1; 114 for (trip_index = 1;
115 trip_index < (MAX_ACTIVE_STATES + 1); trip_index++) { 115 trip_index < MAX_ACTIVE_STATES; trip_index++) {
116 if (est->cur_temp < (est->active_trip_temps[trip_index] 116 if (est->cur_temp < (est->active_trip_temps[trip_index]
117 - est->active_hysteresis[trip_index])) 117 - est->active_hysteresis[trip_index]))
118 break; 118 break;