rrunner: fix buffer overflow
authorDan Carpenter <error27@gmail.com>
Sat, 2 Jan 2010 04:08:46 +0000 (04:08 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 4 Jan 2010 06:06:15 +0000 (22:06 -0800)
tx_skbuff is define as:
        struct sk_buff          *tx_skbuff[TX_RING_ENTRIES];

EVT_RING_ENTRIES is 64 and TX_RING_ENTRIES is 32.

This function is in a error path so that's why it wasn't noticed.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/rrunner.c

index 20a71749154aeb57b83f8f5a08a4a8263415b17c..1c257098d0a61bb8c4719acaf75bcd0ca09072f1 100644 (file)
@@ -1293,7 +1293,7 @@ static void rr_dump(struct net_device *dev)
 
        printk("Error code 0x%x\n", readl(&regs->Fail1));
 
-       index = (((readl(&regs->EvtPrd) >> 8) & 0xff ) - 1) % EVT_RING_ENTRIES;
+       index = (((readl(&regs->EvtPrd) >> 8) & 0xff) - 1) % TX_RING_ENTRIES;
        cons = rrpriv->dirty_tx;
        printk("TX ring index %i, TX consumer %i\n",
               index, cons);