提交 462bed48 编写于 作者: M Manish Chopra 提交者: David S. Miller

qlcnic: Correct off-by-one errors in bounds checks

o Bound checks should be >= instead of > for number of receive descriptors
  and number of receive rings.
Signed-off-by: NManish Chopra <manish.chopra@qlogic.com>
Signed-off-by: NJitendra Kalsaria <jitendra.kalsaria@qlogic.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 d922e1cb
...@@ -1150,13 +1150,13 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter, ...@@ -1150,13 +1150,13 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter,
u16 lro_length, length, data_offset, t_vid, vid = 0xffff; u16 lro_length, length, data_offset, t_vid, vid = 0xffff;
u32 seq_number; u32 seq_number;
if (unlikely(ring > adapter->max_rds_rings)) if (unlikely(ring >= adapter->max_rds_rings))
return NULL; return NULL;
rds_ring = &recv_ctx->rds_rings[ring]; rds_ring = &recv_ctx->rds_rings[ring];
index = qlcnic_get_lro_sts_refhandle(sts_data0); index = qlcnic_get_lro_sts_refhandle(sts_data0);
if (unlikely(index > rds_ring->num_desc)) if (unlikely(index >= rds_ring->num_desc))
return NULL; return NULL;
buffer = &rds_ring->rx_buf_arr[index]; buffer = &rds_ring->rx_buf_arr[index];
...@@ -1662,13 +1662,13 @@ qlcnic_83xx_process_lro(struct qlcnic_adapter *adapter, ...@@ -1662,13 +1662,13 @@ qlcnic_83xx_process_lro(struct qlcnic_adapter *adapter,
u16 vid = 0xffff; u16 vid = 0xffff;
int err; int err;
if (unlikely(ring > adapter->max_rds_rings)) if (unlikely(ring >= adapter->max_rds_rings))
return NULL; return NULL;
rds_ring = &recv_ctx->rds_rings[ring]; rds_ring = &recv_ctx->rds_rings[ring];
index = qlcnic_83xx_hndl(sts_data[0]); index = qlcnic_83xx_hndl(sts_data[0]);
if (unlikely(index > rds_ring->num_desc)) if (unlikely(index >= rds_ring->num_desc))
return NULL; return NULL;
buffer = &rds_ring->rx_buf_arr[index]; buffer = &rds_ring->rx_buf_arr[index];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册