Showing error 1644

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: drivers/net/tokenring/3c359.c
Line in file: 664
Project: Linux Kernel
Project version: 2.6.28
Confirmation: Fixed by d0cc10ab0e3740b629d88386c907342f77cbdb30
Tools: Smatch (1.59)
Entered: 2013-09-10 07:54:05 UTC


Source:

 634
 635        /*
 636         * Now to set up the Rx and Tx buffer structures
 637         */
 638        /* These MUST be on 8 byte boundaries */
 639        xl_priv->xl_tx_ring = kzalloc((sizeof(struct xl_tx_desc) * XL_TX_RING_SIZE) + 7, GFP_DMA | GFP_KERNEL);
 640        if (xl_priv->xl_tx_ring == NULL) {
 641                printk(KERN_WARNING "%s: Not enough memory to allocate rx buffers.\n",
 642                                     dev->name);
 643                free_irq(dev->irq,dev);
 644                return -ENOMEM;
 645        }
 646        xl_priv->xl_rx_ring = kzalloc((sizeof(struct xl_rx_desc) * XL_RX_RING_SIZE) +7, GFP_DMA | GFP_KERNEL);
 647        if (xl_priv->xl_tx_ring == NULL) {
 648                printk(KERN_WARNING "%s: Not enough memory to allocate rx buffers.\n",
 649                                     dev->name);
 650                free_irq(dev->irq,dev);
 651                kfree(xl_priv->xl_tx_ring);
 652                return -ENOMEM;
 653        }
 654
 655         /* Setup Rx Ring */
 656         for (i=0 ; i < XL_RX_RING_SIZE ; i++) { 
 657                struct sk_buff *skb ; 
 658
 659                skb = dev_alloc_skb(xl_priv->pkt_buf_sz) ; 
 660                if (skb==NULL) 
 661                        break ; 
 662
 663                skb->dev = dev ; 
 664                xl_priv->xl_rx_ring[i].upfragaddr = cpu_to_le32(pci_map_single(xl_priv->pdev, skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE));
 665                xl_priv->xl_rx_ring[i].upfraglen = cpu_to_le32(xl_priv->pkt_buf_sz) | RXUPLASTFRAG;
 666                xl_priv->rx_ring_skb[i] = skb ;         
 667        }
 668
 669        if (i==0) { 
 670                printk(KERN_WARNING "%s: Not enough memory to allocate rx buffers. Adapter disabled \n",dev->name) ; 
 671                free_irq(dev->irq,dev) ; 
 672                return -EIO ; 
 673        } 
 674
Show full sources