diag: dci: Prevent using uninitialized variables

Presently chance of using uninitialized variables if a dci
command is not found is avoided by initializing command
structure variables.

Change-Id: I190299917ea6c7fadfc7686d43a7da098e0bc05e
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
This commit is contained in:
Manoj Prabhu B 2019-08-20 14:19:55 +05:30 committed by Gerrit - the friendly Code Review server
parent 2a61e30d44
commit c3403636a9

View file

@ -2078,6 +2078,11 @@ static int diag_process_dci_pkt_rsp(unsigned char *buf, int len)
if ((ret == DIAG_DCI_NO_ERROR && !common_cmd) || ret < 0) if ((ret == DIAG_DCI_NO_ERROR && !common_cmd) || ret < 0)
return ret; return ret;
reg_entry.cmd_code = 0;
reg_entry.subsys_id = 0;
reg_entry.cmd_code_hi = 0;
reg_entry.cmd_code_lo = 0;
if (header_len >= (sizeof(uint8_t))) if (header_len >= (sizeof(uint8_t)))
reg_entry.cmd_code = header->cmd_code; reg_entry.cmd_code = header->cmd_code;
if (header_len >= (2 * sizeof(uint8_t))) if (header_len >= (2 * sizeof(uint8_t)))