From d76237102ff605556939114888e7367da2dc9221 Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Fri, 3 Sep 2004 14:13:11 -0400 Subject: [PATCH] [PATCH] 3c527 possible oops. If the alloc_skb() fails, we dereference it in the skb_reserve() call. Move the skb_reserve() call to after the NULL check. Also clean up some CodingStyle violations whilst in the vicinity. Signed-off-by: Dave Jones --- drivers/net/3c527.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/net/3c527.c b/drivers/net/3c527.c index c6f1995e04682..a39c446c3429d 100644 --- a/drivers/net/3c527.c +++ b/drivers/net/3c527.c @@ -751,18 +751,15 @@ static int mc32_load_rx_ring(struct net_device *dev) rx_base=lp->rx_chain; - for(i=0; irx_ring[i].skb=alloc_skb(1532, GFP_KERNEL); - skb_reserve(lp->rx_ring[i].skb, 18); - - if(lp->rx_ring[i].skb==NULL) - { - for(;i>=0;i--) + if (lp->rx_ring[i].skb==NULL) { + for (;i>=0;i--) kfree_skb(lp->rx_ring[i].skb); return -ENOBUFS; } - + skb_reserve(lp->rx_ring[i].skb, 18); + p=isa_bus_to_virt(lp->base+rx_base); p->control=0; -- 2.53.0