Skip to content

Commit

Permalink
core/pldm: Fix Use of uninitialised value
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Reza Arbab <[email protected]>
  • Loading branch information
abhisheksinghtomar authored and rarbab committed Aug 2, 2024
1 parent a9830fc commit 8fa4aae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/pldm/pldm-platform-requests.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 8fa4aae

Please sign in to comment.