mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 22:40:54 -04:00
usb: dwc3-msm: Add explicit out-of-bounds check before array access
Explicitly adding out-of-bounds check to ensure bus_vote_values and mdwc->dbm_ep_num_mapping use indices within their specified range. Change-Id: I196f69011f2c2392477e11b6eb19a395bb753dc5 Signed-off-by: Ronak Vijay Raheja <rraheja@codeaurora.org>
This commit is contained in:
parent
158801d1ab
commit
182eba5d94
1 changed files with 4 additions and 4 deletions
|
|
@ -658,7 +658,7 @@ static int dbm_get_num_of_eps_configured(struct dwc3_msm *mdwc)
|
|||
int i;
|
||||
int count = 0;
|
||||
|
||||
for (i = 0; i < mdwc->dbm_num_eps; i++)
|
||||
for (i = 0; i < min(mdwc->dbm_num_eps, DBM_1_5_NUM_EP); i++)
|
||||
if (mdwc->dbm_ep_num_mapping[i])
|
||||
count++;
|
||||
|
||||
|
|
@ -2773,9 +2773,9 @@ static int dwc3_msm_update_bus_bw(struct dwc3_msm *mdwc, enum bus_vote bv)
|
|||
* set it to _NONE irrespective of the requested vote
|
||||
* from userspace.
|
||||
*/
|
||||
if (bv >= BUS_VOTE_MAX)
|
||||
bv_index = mdwc->default_bus_vote;
|
||||
else if (bv == BUS_VOTE_NONE)
|
||||
if (bv_index >= BUS_VOTE_MAX)
|
||||
bv_index = BUS_VOTE_MAX - 1;
|
||||
else if (bv_index < BUS_VOTE_NONE)
|
||||
bv_index = BUS_VOTE_NONE;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(mdwc->icc_paths); i++) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue