fix: flags that mbz are checked
Added a check that the flags MBZ are checked
in the handling of FFA_NOTICATION_SET.
Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: I3115126104cffcacb5f03a937436ce792a942294
diff --git a/src/api.c b/src/api.c
index 2ac9f91..c733bbf 100644
--- a/src/api.c
+++ b/src/api.c
@@ -3867,13 +3867,21 @@
{
struct ffa_value ret;
struct vm_locked receiver_locked;
-
/*
* Check if is per-vCPU or global, and extracting vCPU ID according
* to table 17.19 of the FF-A v1.1 Beta 0 spec.
*/
bool is_per_vcpu = (flags & FFA_NOTIFICATION_FLAG_PER_VCPU) != 0U;
ffa_vcpu_index_t vcpu_id = (uint16_t)(flags >> 16);
+ const uint32_t flags_mbz =
+ ~(FFA_NOTIFICATIONS_FLAG_PER_VCPU |
+ FFA_NOTIFICATIONS_FLAG_DELAY_SRI | (0xFFFFU << 16));
+
+ if ((flags_mbz & flags) != 0U) {
+ dlog_verbose("%s: caller shouldn't set bits that MBZ.\n",
+ __func__);
+ return ffa_error(FFA_INVALID_PARAMETERS);
+ }
if (!plat_ffa_is_notification_set_valid(current, sender_vm_id,
receiver_vm_id)) {