summaryrefslogtreecommitdiff
path: root/drivers/firmware/arm_scmi/protocols.h
diff options
context:
space:
mode:
authorCristian Marussi <cristian.marussi@arm.com>2022-06-16 20:03:47 +0300
committerSudeep Holla <sudeep.holla@arm.com>2022-06-20 12:17:33 +0300
commit754f04cac362417b157e30d5dc4046b5ec92060c (patch)
treec0f1f79fdfbc15fadc335bce1b11a12c1f74987c /drivers/firmware/arm_scmi/protocols.h
parent44dbdf3bb3f44bf08897ed5f22eb262edcf3d926 (diff)
downloadlinux-754f04cac362417b157e30d5dc4046b5ec92060c.tar.xz
firmware: arm_scmi: Relax CLOCK_DESCRIBE_RATES out-of-spec checks
A reply to CLOCK_DESCRIBE_RATES issued against a non rate-discrete clock should be composed of a triplet of rates descriptors (min/max/step) returned all in one reply message. This is not always the case when dealing with some SCMI server deployed in the wild: relax such constraint while maintaining memory safety by checking carefully the returned payload size. While at that cleanup a stale debug printout. Link: https://lore.kernel.org/r/20220616170347.2800771-1-cristian.marussi@arm.com Fixes: 7bc7caafe6b1 ("firmware: arm_scmi: Use common iterators in the clock protocol") Tested-by: Robin Murphy <robin.murphy@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/protocols.h')
-rw-r--r--drivers/firmware/arm_scmi/protocols.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/firmware/arm_scmi/protocols.h b/drivers/firmware/arm_scmi/protocols.h
index c679f3fb8718..51c31379f9b3 100644
--- a/drivers/firmware/arm_scmi/protocols.h
+++ b/drivers/firmware/arm_scmi/protocols.h
@@ -179,6 +179,8 @@ struct scmi_protocol_handle {
* @max_resources: Maximum acceptable number of items, configured by the caller
* depending on the underlying resources that it is querying.
* @loop_idx: The iterator loop index in the current multi-part reply.
+ * @rx_len: Size in bytes of the currenly processed message; it can be used by
+ * the user of the iterator to verify a reply size.
* @priv: Optional pointer to some additional state-related private data setup
* by the caller during the iterations.
*/
@@ -188,6 +190,7 @@ struct scmi_iterator_state {
unsigned int num_remaining;
unsigned int max_resources;
unsigned int loop_idx;
+ size_t rx_len;
void *priv;
};