dsp: platform: Fix decode_set_event_receiver_req()
Per DSP0248 V1.3.0 table13, the heartbeatTimer field shall be omitted
from the request data if eventMessageGlobalEnable is not set to
enableAsyncKeepAlive.
gitlint-ignore: B1, UC1
Fixes: 66c7723adbdc ("msgbuf: Enable pldm_msgbuf_extract() into packed members")
Fixes: 9667f5823930 ("platform: pldm_msgbuf for decode_set_event_receiver_req()")
Fixes: 6ef2aa90a793 ("platform: Test invalid heartbeat conditions after assignment")
Fixes: 9c76679224cf ("libpldm: Migrate to subproject")
Change-Id: Ia2a0c71a1f37a0fd32670b9b66b051e18fb73dbe
Signed-off-by: Gilbert Chen <gilbertc@nvidia.com>
diff --git a/src/dsp/platform.c b/src/dsp/platform.c
index 4b6898e..a800da5 100644
--- a/src/dsp/platform.c
+++ b/src/dsp/platform.c
@@ -2429,9 +2429,16 @@
}
pldm_msgbuf_extract_p(buf, event_message_global_enable);
+ if (rc) {
+ return rc;
+ }
+
pldm_msgbuf_extract_p(buf, transport_protocol_type);
pldm_msgbuf_extract_p(buf, event_receiver_address_info);
- pldm_msgbuf_extract_p(buf, heartbeat_timer);
+ if ((*event_message_global_enable ==
+ PLDM_EVENT_MESSAGE_GLOBAL_ENABLE_ASYNC_KEEP_ALIVE)) {
+ pldm_msgbuf_extract_p(buf, heartbeat_timer);
+ }
rc = pldm_msgbuf_destroy(buf);
if (rc) {