tree 2fb09b6a44e17c0c3c85512a6c0ba7f5a983c0b0
parent abdf119b4dad015803819c3d046d20cfbd393e87
author Roland Dreier <[EMAIL PROTECTED]> Thu, 28 Jul 2005 04:41:32 -0700
committer Roland Dreier <[EMAIL PROTECTED]> Thu, 28 Jul 2005 04:41:32 -0700

[IB/ipoib]: Fix unsigned comparisons to handle wraparound

Fix handling of tx_head/tx_tail comparisons to handle wraparound.

Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>

 drivers/infiniband/ulp/ipoib/ipoib_ib.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c 
b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -81,7 +81,7 @@ void ipoib_free_ah(struct kref *kref)
 
        unsigned long flags;
 
-       if (ah->last_send <= priv->tx_tail) {
+       if ((int) priv->tx_tail - (int) ah->last_send >= 0) {
                ipoib_dbg(priv, "Freeing ah %p\n", ah->ah);
                ib_destroy_ah(ah->ah);
                kfree(ah);
@@ -355,7 +355,7 @@ static void __ipoib_reap_ah(struct net_d
 
        spin_lock_irq(&priv->lock);
        list_for_each_entry_safe(ah, tah, &priv->dead_ahs, list)
-               if (ah->last_send <= priv->tx_tail) {
+               if ((int) priv->tx_tail - (int) ah->last_send >= 0) {
                        list_del(&ah->list);
                        list_add_tail(&ah->list, &remove_list);
                }
@@ -486,7 +486,7 @@ int ipoib_ib_dev_stop(struct net_device 
                         * assume the HW is wedged and just free up
                         * all our pending work requests.
                         */
-                       while (priv->tx_tail < priv->tx_head) {
+                       while ((int) priv->tx_tail - (int) priv->tx_head < 0) {
                                tx_req = &priv->tx_ring[priv->tx_tail &
                                                        (IPOIB_TX_RING_SIZE - 
1)];
                                dma_unmap_single(priv->ca->dma_device,
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to