diff options
author | Cristian Marussi <cristian.marussi@arm.com> | 2022-08-17 20:27:27 +0300 |
---|---|---|
committer | Sudeep Holla <sudeep.holla@arm.com> | 2022-08-22 20:01:45 +0300 |
commit | 1ecb7d27b1af6705e9a4e94415b4d8cc8cf2fbfb (patch) | |
tree | 571408f5a8bc6befab7993c83177e7bcaee2a020 /drivers/firmware/arm_scmi/sensors.c | |
parent | 2e42b1652df00daf7000011ec9917f2eda534190 (diff) | |
download | linux-1ecb7d27b1af6705e9a4e94415b4d8cc8cf2fbfb.tar.xz |
firmware: arm_scmi: Improve checks in the info_get operations
SCMI protocols abstract and expose a number of protocol specific
resources like clocks, sensors and so on. Information about such
specific domain resources are generally exposed via an `info_get`
protocol operation.
Improve the sanity check on these operations where needed.
Link: https://lore.kernel.org/r/20220817172731.1185305-3-cristian.marussi@arm.com
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Diffstat (limited to 'drivers/firmware/arm_scmi/sensors.c')
-rw-r--r-- | drivers/firmware/arm_scmi/sensors.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c index 7288c6117838..7d0c7476d206 100644 --- a/drivers/firmware/arm_scmi/sensors.c +++ b/drivers/firmware/arm_scmi/sensors.c @@ -948,6 +948,9 @@ scmi_sensor_info_get(const struct scmi_protocol_handle *ph, u32 sensor_id) { struct sensors_info *si = ph->get_priv(ph); + if (sensor_id >= si->num_sensors) + return NULL; + return si->sensors + sensor_id; } |