]> git.baikalelectronics.ru Git - kernel.git/commit
PM / devfreq: Strengthen check for freq_table
authorSamuel Holland <samuel@sholland.org>
Wed, 29 Sep 2021 04:42:45 +0000 (23:42 -0500)
committerChanwoo Choi <cw00.choi@samsung.com>
Wed, 27 Oct 2021 05:22:12 +0000 (14:22 +0900)
commit23eab7a2e33588c40a79ce5345abd6b6139a9d57
tree9286f02a87eeca28f1b7e819125fa43b30e8f5ce
parent8b20f13ef04ecaa76f175116d7b1656fb3a9000d
PM / devfreq: Strengthen check for freq_table

Since commit 7f4c375e3e72 ("PM / devfreq: Change return type of
devfreq_set_freq_table()"), all devfreq devices are expected to have a
valid freq_table. The devfreq core unconditionally dereferences
freq_table in the sysfs code and in get_freq_range().

Therefore, we need to ensure that freq_table is both non-null and
non-empty (length is > 0). If either check fails, replace the table
using set_freq_table() or return the error.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
drivers/devfreq/devfreq.c