]> git.baikalelectronics.ru Git - kernel.git/commit
cxgb4: fix signed wrap around when decrementing index idx
authorColin Ian King <colin.king@canonical.com>
Thu, 22 Sep 2016 17:48:58 +0000 (18:48 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 23 Sep 2016 11:25:16 +0000 (07:25 -0400)
commit557cb96deddec639320e60a3e84702902b38b8fd
tree5deca3943fa0b2d4c99a43c7381a12f352dfe2ae
parent9cfb58e1cd3620521f1b7182b3f59362ac274974
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>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c