fix(rss): fix bound check during protocol selection

Fix the wrong placement of the closing parenthesis in the second
condition check that resulted in the incorrect calculation of the MHU
message size. Also, format the code for readability.

Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
Change-Id: I0e012f3ff00bae2dfc12cdb1c2c636fc6c0a0b55
This commit is contained in:
Vijayenthiran Subramaniam 2023-12-06 14:27:09 +05:30
parent 5cd10848be
commit f754bd4667

View file

@ -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;