Skip to content

Commit

Permalink
korina: fix loop back of receive descriptors
Browse files Browse the repository at this point in the history
After the last loop iteration, i has the value RC32434_NUM_RDS and
therefore leads to an index overflow when used afterwards to address the
last element. This is yet another another bug introduced when rewriting
parts of the driver for upstream preparation, as the original driver
used 'RC32434_NUM_RDS - 1' instead.

Signed-off-by: Phil Sutter <n0-1@freewrt.org>
Acked-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Phil Sutter authored and David S. Miller committed Jan 20, 2009
1 parent eed087e commit 6a2fe98
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/net/korina.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,11 +769,12 @@ static void korina_alloc_ring(struct net_device *dev)
lp->rd_ring[i].link = CPHYSADDR(&lp->rd_ring[i+1]);
}

/* loop back */
lp->rd_ring[i].link = CPHYSADDR(&lp->rd_ring[0]);
lp->rx_next_done = 0;
/* loop back receive descriptors, so the last
* descriptor points to the first one */
lp->rd_ring[i - 1].link = CPHYSADDR(&lp->rd_ring[0]);
lp->rd_ring[i - 1].control |= DMA_DESC_COD;

lp->rd_ring[i].control |= DMA_DESC_COD;
lp->rx_next_done = 0;
lp->rx_chain_head = 0;
lp->rx_chain_tail = 0;
lp->rx_chain_status = desc_empty;
Expand Down

0 comments on commit 6a2fe98

Please sign in to comment.