From: Kulikov Vasiliy Date: Thu, 15 Jul 2010 08:45:57 +0000 (+0000) Subject: drivers: ixgbevf: fix unsigned underflow X-Git-Tag: MMI-PSA29.97-13-9~23092^2~202 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2540ddb5124f883bba3d4af5d8920d44dd66e794;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git drivers: ixgbevf: fix unsigned underflow 'count' is unsigned. It is initialized to zero, then it can be increased multiple times, and finally it is used in such a way: >>>> count--; | | /* clear timestamp and dma mappings for remaining portion of packet */ | while (count >= 0) { | count--; | ... ^ If count is zero here (so, it was never increased), we would have a very long loop :) Signed-off-by: Kulikov Vasiliy Signed-off-by: David S. Miller --- diff --git a/drivers/net/ixgbevf/ixgbevf_main.c b/drivers/net/ixgbevf/ixgbevf_main.c index 73f1e75f68d4..af491352b5e0 100644 --- a/drivers/net/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ixgbevf/ixgbevf_main.c @@ -2935,7 +2935,8 @@ static int ixgbevf_tx_map(struct ixgbevf_adapter *adapter, struct ixgbevf_tx_buffer *tx_buffer_info; unsigned int len; unsigned int total = skb->len; - unsigned int offset = 0, size, count = 0; + unsigned int offset = 0, size; + int count = 0; unsigned int nr_frags = skb_shinfo(skb)->nr_frags; unsigned int f; int i;