From 8fa4aae8ceeed933a75fd9b00d7374bbfa2a531b Mon Sep 17 00:00:00 2001 From: Abhishek Singh Tomar Date: Fri, 14 Jun 2024 13:16:02 +0530 Subject: [PATCH] core/pldm: Fix Use of uninitialised value In decode_platform_event_message_resp() when response.completion_code is not PLDM_SUCCESS then response.platform_event_status remain uninitialized this end up triggering following warning ==48024== Use of uninitialised value of size 8 ==48024== at 0x48D12CB: _itoa_word (_itoa.c:183) ==48024== by 0x48DBFA1: __printf_buffer (vfprintf-process-arg.c:155) ==48024== by 0x48DE072: __vfprintf_internal (vfprintf-internal.c:1559) ==48024== by 0x42DD97: vprintf (stdio.h:41) ==48024== by 0x42DD97: _prlog (stubs.c:27) ==48024== by 0x426C92: send_repository_changed_event (pldm-platform-requests.c:929) ==48024== by 0x426E7D: add_hosted_pdrs (pldm-platform-requests.c:973) ==48024== by 0x427752: pldm_platform_init (pldm-platform-requests.c:1226) Fix issue by intializing struct response with 0. Signed-off-by: Abhishek Singh Tomar Signed-off-by: Reza Arbab --- core/pldm/pldm-platform-requests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/pldm/pldm-platform-requests.c b/core/pldm/pldm-platform-requests.c index 62e8b0e83c0..7e1f3e3b6fe 100644 --- a/core/pldm/pldm-platform-requests.c +++ b/core/pldm/pldm-platform-requests.c @@ -834,7 +834,7 @@ static int send_repository_changed_event(uint32_t num_changed_pdrs, .event_class = PLDM_PDR_REPOSITORY_CHG_EVENT, }; - struct pldm_platform_event_message_resp response; + struct pldm_platform_event_message_resp response = {0}; prlog(PR_DEBUG, "%s - num_changed_pdrs: %d\n", __func__, num_changed_pdrs);