diff --git a/drivers/arm/mhu/mhu_wrapper_v2_x.c b/drivers/arm/mhu/mhu_wrapper_v2_x.c index 60de1d38c..54a588126 100644 --- a/drivers/arm/mhu/mhu_wrapper_v2_x.c +++ b/drivers/arm/mhu/mhu_wrapper_v2_x.c @@ -308,5 +308,10 @@ size_t mhu_get_max_message_size(void) assert(num_channels != 0); - return num_channels * sizeof(uint32_t); + /* + * Returns only usable size of memory. As one channel is specifically + * used to inform about the size of payload, discard it from avialable + * memory size. + */ + return (num_channels - 1) * sizeof(uint32_t); } diff --git a/drivers/arm/rss/rss_comms.c b/drivers/arm/rss/rss_comms.c index 4622af980..a905b8831 100644 --- a/drivers/arm/rss/rss_comms.c +++ b/drivers/arm/rss/rss_comms.c @@ -59,8 +59,10 @@ static uint8_t select_protocol_version(const psa_invec *in_vec, size_t in_len, * messages due to ATU configuration costs to allow access to the * pointers. */ - if ((comms_embed_msg_min_size + in_size_total > comms_mhu_msg_size - sizeof(uint32_t)) - || (comms_embed_reply_min_size + out_size_total > comms_mhu_msg_size) - sizeof(uint32_t)) { + if ((comms_embed_msg_min_size + in_size_total > + comms_mhu_msg_size - sizeof(uint32_t)) || + (comms_embed_reply_min_size + out_size_total > + comms_mhu_msg_size - sizeof(uint32_t))) { return RSS_COMMS_PROTOCOL_POINTER_ACCESS; } else { return RSS_COMMS_PROTOCOL_EMBED;