提交 c1fa347f 编写于 作者: R Roel Kluin 提交者: David S. Miller

e1000/e1000e/igb/igbvf/ixgb/ixgbe: Fix tests of unsigned in *_tx_map()

The variable count and i are unsigned so the (<|>=)0 tests do not work.
Signed-off-by: NRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 b4ced2b7
...@@ -2802,13 +2802,13 @@ static int e1000_tx_map(struct e1000_adapter *adapter, ...@@ -2802,13 +2802,13 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
dma_error: dma_error:
dev_err(&pdev->dev, "TX DMA map failed\n"); dev_err(&pdev->dev, "TX DMA map failed\n");
buffer_info->dma = 0; buffer_info->dma = 0;
count--; if (count)
while (count >= 0) {
count--; count--;
i--;
if (i < 0) while (count--) {
if (i==0)
i += tx_ring->count; i += tx_ring->count;
i--;
buffer_info = &tx_ring->buffer_info[i]; buffer_info = &tx_ring->buffer_info[i];
e1000_unmap_and_free_tx_resource(adapter, buffer_info); e1000_unmap_and_free_tx_resource(adapter, buffer_info);
} }
......
...@@ -3962,13 +3962,13 @@ static int e1000_tx_map(struct e1000_adapter *adapter, ...@@ -3962,13 +3962,13 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
dma_error: dma_error:
dev_err(&pdev->dev, "TX DMA map failed\n"); dev_err(&pdev->dev, "TX DMA map failed\n");
buffer_info->dma = 0; buffer_info->dma = 0;
count--; if (count)
while (count >= 0) {
count--; count--;
i--;
if (i < 0) while (count--) {
if (i==0)
i += tx_ring->count; i += tx_ring->count;
i--;
buffer_info = &tx_ring->buffer_info[i]; buffer_info = &tx_ring->buffer_info[i];
e1000_put_txbuf(adapter, buffer_info);; e1000_put_txbuf(adapter, buffer_info);;
} }
......
...@@ -2163,14 +2163,14 @@ static inline int igbvf_tx_map_adv(struct igbvf_adapter *adapter, ...@@ -2163,14 +2163,14 @@ static inline int igbvf_tx_map_adv(struct igbvf_adapter *adapter,
buffer_info->length = 0; buffer_info->length = 0;
buffer_info->next_to_watch = 0; buffer_info->next_to_watch = 0;
buffer_info->mapped_as_page = false; buffer_info->mapped_as_page = false;
count--; if (count)
count--;
/* clear timestamp and dma mappings for remaining portion of packet */ /* clear timestamp and dma mappings for remaining portion of packet */
while (count >= 0) { while (count--) {
count--; if (i==0)
i--;
if (i < 0)
i += tx_ring->count; i += tx_ring->count;
i--;
buffer_info = &tx_ring->buffer_info[i]; buffer_info = &tx_ring->buffer_info[i];
igbvf_put_txbuf(adapter, buffer_info); igbvf_put_txbuf(adapter, buffer_info);
} }
......
...@@ -1363,13 +1363,13 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb, ...@@ -1363,13 +1363,13 @@ ixgb_tx_map(struct ixgb_adapter *adapter, struct sk_buff *skb,
dma_error: dma_error:
dev_err(&pdev->dev, "TX DMA map failed\n"); dev_err(&pdev->dev, "TX DMA map failed\n");
buffer_info->dma = 0; buffer_info->dma = 0;
count--; if (count)
while (count >= 0) {
count--; count--;
i--;
if (i < 0) while (count--) {
if (i==0)
i += tx_ring->count; i += tx_ring->count;
i--;
buffer_info = &tx_ring->buffer_info[i]; buffer_info = &tx_ring->buffer_info[i];
ixgb_unmap_and_free_tx_resource(adapter, buffer_info); ixgb_unmap_and_free_tx_resource(adapter, buffer_info);
} }
......
...@@ -5167,14 +5167,14 @@ static int ixgbe_tx_map(struct ixgbe_adapter *adapter, ...@@ -5167,14 +5167,14 @@ static int ixgbe_tx_map(struct ixgbe_adapter *adapter,
tx_buffer_info->dma = 0; tx_buffer_info->dma = 0;
tx_buffer_info->time_stamp = 0; tx_buffer_info->time_stamp = 0;
tx_buffer_info->next_to_watch = 0; tx_buffer_info->next_to_watch = 0;
count--; if (count)
count--;
/* clear timestamp and dma mappings for remaining portion of packet */ /* clear timestamp and dma mappings for remaining portion of packet */
while (count >= 0) { while (count--) {
count--; if (i==0)
i--;
if (i < 0)
i += tx_ring->count; i += tx_ring->count;
i--;
tx_buffer_info = &tx_ring->tx_buffer_info[i]; tx_buffer_info = &tx_ring->tx_buffer_info[i];
ixgbe_unmap_and_free_tx_resource(adapter, tx_buffer_info); ixgbe_unmap_and_free_tx_resource(adapter, tx_buffer_info);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册