msm: camera: fix off-by-one overflow in msm_isp_get_bufq

In msm_isp_get_bufq, if bufq_index == buf_mgr->num_buf_q,
it will pass the check, leading to off-by-one overflow
(exceed the length of array by one element).

CRs-Fixed: 2031677
Change-Id: I7ea465897e2c37de6ca0155c3e225f1444b3cf13
Signed-off-by: Gaoxiang Chen <gaochen@codeaurora.org>
This commit is contained in:
Gaoxiang Chen 2017-05-17 15:14:36 +08:00 committed by Gerrit - the friendly Code Review server
parent 14f6bfeeeb
commit a476e30e30

View file

@ -86,7 +86,7 @@ struct msm_isp_bufq *msm_isp_get_bufq(
/* bufq_handle cannot be 0 */ /* bufq_handle cannot be 0 */
if ((bufq_handle == 0) || if ((bufq_handle == 0) ||
bufq_index >= BUF_MGR_NUM_BUF_Q || bufq_index >= BUF_MGR_NUM_BUF_Q ||
(bufq_index > buf_mgr->num_buf_q)) (bufq_index >= buf_mgr->num_buf_q))
return NULL; return NULL;
bufq = &buf_mgr->bufq[bufq_index]; bufq = &buf_mgr->bufq[bufq_index];