NFC: Fix possible NULL pointer dereference issue

Due to possible NULL pointer dereference
kw issues are seen.

Modify code and add proper NULL check to avoid
NULL pointer dereference.

Change-Id: Ie9f19fa9ac57a108575c08bdc123313eea3df49c
Signed-off-by: Tapas Dey <tdey@codeaurora.org>
This commit is contained in:
Tapas Dey 2020-11-24 20:16:10 +05:30
parent 6a2beea9de
commit 6aa08d2a70

View File

@ -369,10 +369,14 @@ void read_cold_reset_rsp(struct nfc_dev *nfc_dev, char *header)
__func__);
goto error;
}
} else {
} else if (header) {
/* For I3C driver, header is read by the worker thread */
memcpy(cold_reset_rsp, header, NCI_HDR_LEN);
} else {
pr_err("%s: - invalid or NULL header\n", __func__);
goto error;
}
if ((cold_reset_rsp[0] != COLD_RESET_RSP_GID)