From: Dan Carpenter Date: Sat, 2 Jan 2010 04:08:46 +0000 (+0000) Subject: rrunner: fix buffer overflow X-Git-Tag: firefly_0821_release~9833^2~3158^2~138 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2585e7e5e1fcf64fd2b2cac0bc1f1b609eabe96a;p=firefly-linux-kernel-4.4.55.git rrunner: fix buffer overflow 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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c index 20a71749154a..1c257098d0a6 100644 --- a/drivers/net/rrunner.c +++ b/drivers/net/rrunner.c @@ -1293,7 +1293,7 @@ static void rr_dump(struct net_device *dev) printk("Error code 0x%x\n", readl(®s->Fail1)); - index = (((readl(®s->EvtPrd) >> 8) & 0xff ) - 1) % EVT_RING_ENTRIES; + index = (((readl(®s->EvtPrd) >> 8) & 0xff) - 1) % TX_RING_ENTRIES; cons = rrpriv->dirty_tx; printk("TX ring index %i, TX consumer %i\n", index, cons);