Skip to content

Commit 53b4b2a

Browse files
digetxchanwoochoi
authored andcommitted
PM / devfreq: tegra30: Fix integer overflow on CPU's freq max out
There is another kHz-conversion bug in the code, resulting in integer overflow. Although, this time the resulting value is 4294966296 and it's close to ULONG_MAX, which is okay in this case. Reviewed-by: Chanwoo Choi <[email protected]> Tested-by: Peter Geis <[email protected]> Signed-off-by: Dmitry Osipenko <[email protected]> Signed-off-by: Chanwoo Choi <[email protected]>
1 parent e7955a3 commit 53b4b2a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/devfreq/tegra30-devfreq.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969

7070
#define KHZ 1000
7171

72+
#define KHZ_MAX (ULONG_MAX / KHZ)
73+
7274
/* Assume that the bus is saturated if the utilization is 25% */
7375
#define BUS_SATURATION_RATIO 25
7476

@@ -170,7 +172,7 @@ struct tegra_actmon_emc_ratio {
170172
};
171173

172174
static struct tegra_actmon_emc_ratio actmon_emc_ratios[] = {
173-
{ 1400000, ULONG_MAX },
175+
{ 1400000, KHZ_MAX },
174176
{ 1200000, 750000 },
175177
{ 1100000, 600000 },
176178
{ 1000000, 500000 },

0 commit comments

Comments
 (0)