[COMMON] thermal: isp: Modify loop count(KASAN bug)
authorSoomin Kim <sm8326.kim@samsung.com>
Mon, 26 Sep 2016 01:27:00 +0000 (10:27 +0900)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:13:28 +0000 (17:13 +0900)
Since loop size is bigger than ECT table size for
thermal throttling. So, fix it.

Change-Id: Ifc4e2c37d480bf3d71a516cb4fbbb1f63b4b4612
Signed-off-by: Soomin Kim <sm8326.kim@samsung.com>
drivers/thermal/isp_cooling.c

index 5c54fdebcd58cec0400dc49b3033ef880be633e5..b4523b59cbb9c28547403349af68048049639a9c 100644 (file)
@@ -522,24 +522,23 @@ int isp_cooling_table_init(struct platform_device *pdev)
        isp_fps_table = kzalloc(sizeof(struct isp_fps_table) * (function->num_of_range + 1), GFP_KERNEL);
 
        if (thermal_block != NULL && function != NULL) {
-               for (i = 0; i < function->num_of_range + 1; i++) {
+               for (i = 0; i < function->num_of_range; i++) {
                        if (last_fps == function->range_list[i].max_frequency)
                                continue;
 
                        isp_fps_table[count].flags = 0;
                        isp_fps_table[count].driver_data = count;
-
-                       if (i == function->num_of_range)
-                               isp_fps_table[count].fps = ISP_FPS_TABLE_END;
-                       else
-                               isp_fps_table[count].fps = function->range_list[i].max_frequency;
-
+                       isp_fps_table[count].fps = function->range_list[i].max_frequency;
                        last_fps = isp_fps_table[count].fps;
 
                        dev_info(&pdev->dev, "[ISP TMU] index : %d, fps : %d \n",
                                isp_fps_table[count].driver_data, isp_fps_table[count].fps);
                        count++;
                }
+
+               if (i == function->num_of_range)
+                       isp_fps_table[count + 1].fps = ISP_FPS_TABLE_END;
+
        } else
                return -EINVAL;
 #else