summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/chelsio
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2016-09-22 18:48:58 +0100
committerDavid S. Miller <davem@davemloft.net>2016-09-23 07:25:16 -0400
commite12934d9806e61d2727069cd56757987f3da76aa (patch)
tree5deca3943fa0b2d4c99a43c7381a12f352dfe2ae /drivers/net/ethernet/chelsio
parentc7b9e63341db3ab2160194ebbf0d3d6041419cee (diff)
downloadop-kernel-dev-e12934d9806e61d2727069cd56757987f3da76aa.zip
op-kernel-dev-e12934d9806e61d2727069cd56757987f3da76aa.tar.gz
cxgb4: fix signed wrap around when decrementing index idx
Change predecrement compare to post decrement compare to avoid an unsigned integer wrap-around comparison when decrementing idx in the while loop. For example, when idx is zero, the current situation will predecrement idx in the while loop, wrapping idx to the maximum signed integer and cause out of bounds reads on rxq_info->msix_tbl[idx]. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/chelsio')
-rw-r--r--drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
index d12a73e..f13b593 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
@@ -367,7 +367,7 @@ int request_msix_queue_irqs_uld(struct adapter *adap, unsigned int uld_type)
}
return 0;
unwind:
- while (--idx >= 0) {
+ while (idx-- > 0) {
bmap_idx = rxq_info->msix_tbl[idx];
free_msix_idx_in_bmap(adap, bmap_idx);
free_irq(adap->msix_info_ulds[bmap_idx].vec,
OpenPOWER on IntegriCloud