BZ: 35199
This is klockwork tool build error. The ep_index variable possible equal
to -1, then cause the eps array overflow.
Change-Id: If7722a411d6cb415ba0481fc6a0e4784adc469f3
Signed-off-by: Yu Wang <yu.y.wang@intel.com>
Reviewed-on: http://android.intel.com:8080/47758
Reviewed-by: Tang, Richard <richard.tang@intel.com>
Tested-by: Gao, Yunpeng <yunpeng.gao@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
/* Endpoint ID is 1 based, our index is zero based */
ep_index = TRB_TO_EP_ID(le32_to_cpu(event->flags)) - 1;
+ if (ep_index == -1) {
+ xhci_err(xhci, "ERROR event endpoint index should start from one\n ");
+ return -EINVAL;
+ }
ep = &xdev->eps[ep_index];
ep_ring = xhci_dma_to_transfer_ring(ep, le64_to_cpu(event->buffer));
ep_ctx = xhci_get_ep_ctx(xhci, xdev->out_ctx, ep_index);