msm: ipa: Fix KW P1 issue

KW tool detect the potential NULL access and buffer
index overflow issue.
The change is to add the proper handle for NULL response
and prevent buffer index overflow.

Change-Id: I0bb1b45ba6e5b0abe6c3539d451f74e19028737c
Signed-off-by: Bojun Pan <bojunp@codeaurora.org>
This commit is contained in:
Bojun Pan 2019-09-05 16:41:24 -07:00 • committed by Gerrit - the friendly Code Review server
commit 2a54c015b8
2 changed files with 5 additions and 2 deletions

View file

@ -384,6 +384,9 @@ static void ipa3_handle_mhi_vote_req(struct qmi_handle *qmi_handle,
IPA_QMI_ERR_NOT_SUPPORTED_V01;
}
resp = &resp2;
} else {
IPAWANERR("clk_rate_valid is false\n");
return;
}
} else {
resp = imp_handle_vote_req(vote_req->mhi_vote);

View file

@ -403,10 +403,10 @@ static ssize_t ipa_ut_dbgfs_meta_test_read(struct file *file,
meta_type = (long)(file->private_data);
IPA_UT_DBG("Meta test type %ld\n", meta_type);
buf = kmalloc(IPA_UT_DEBUG_READ_BUF_SIZE, GFP_KERNEL);
buf = kmalloc(IPA_UT_DEBUG_READ_BUF_SIZE + 1, GFP_KERNEL);
if (!buf) {
IPA_UT_ERR("failed to allocate %d bytes\n",
IPA_UT_DEBUG_READ_BUF_SIZE);
IPA_UT_DEBUG_READ_BUF_SIZE + 1);
cnt = 0;
goto unlock_mutex;
}