]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
firmware: arm_scmi: fix divide by zero when sustained_perf_level is zero
authorSudeep Holla <sudeep.holla@arm.com>
Thu, 6 Sep 2018 15:10:39 +0000 (16:10 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Oct 2018 06:55:57 +0000 (08:55 +0200)
commit784ce43a54fad28f43fd202f8e3bab9ce4c3ca99
tree9cc3259110b12c39307d6c7d6d4fbccee6a61cde
parent131a6926fa4d923802ba02832ff546cb1c5d145e
firmware: arm_scmi: fix divide by zero when sustained_perf_level is zero

[ Upstream commit 96d529bac562574600eda85726fcfa3eef6dde8e ]

Firmware can provide zero as values for sustained performance level and
corresponding sustained frequency in kHz in order to hide the actual
frequencies and provide only abstract values. It may endup with divide
by zero scenario resulting in kernel panic.

Let's set the multiplication factor to one if either one or both of them
(sustained_perf_level and sustained_freq) are set to zero.

Fixes: a9e3fbfaa0ff ("firmware: arm_scmi: add initial support for performance protocol")
Reported-by: Ionela Voinescu <ionela.voinescu@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/firmware/arm_scmi/perf.c