[Skiboot] [PATCH 2/2] core/pldm: Fix Use of uninitialised value

Abhishek Singh Tomar abhishek at linux.ibm.com
Fri Jun 14 17:46:02 AEST 2024


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 <abhishek at linux.ibm.com>
---
 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 21ec43a47..e129b3a37 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);
 
-- 
2.45.2



More information about the Skiboot mailing list