]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
drivers: ixgbevf: fix unsigned underflow
authorKulikov Vasiliy <segooon@gmail.com>
Thu, 15 Jul 2010 08:45:57 +0000 (08:45 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 Jul 2010 03:27:58 +0000 (20:27 -0700)
'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 <segooon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ixgbevf/ixgbevf_main.c

index 73f1e75f68d4e438b0c5ef563b28e410adba4bff..af491352b5e00eb2de151ff63bb73b519897b679 100644 (file)
@@ -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;