From c3403636a989d57cea9b0fd8ff07860e805e0c8c Mon Sep 17 00:00:00 2001 From: Manoj Prabhu B Date: Tue, 20 Aug 2019 14:19:55 +0530 Subject: [PATCH] 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 --- drivers/char/diag/diag_dci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/char/diag/diag_dci.c b/drivers/char/diag/diag_dci.c index ad00b91ae173..2301e1e566e0 100644 --- a/drivers/char/diag/diag_dci.c +++ b/drivers/char/diag/diag_dci.c @@ -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) 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))) reg_entry.cmd_code = header->cmd_code; if (header_len >= (2 * sizeof(uint8_t)))