Showing error 1881

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: net/atm/mpc.c
Line in file: 564
Project: Linux Kernel
Project version: 2.6.28
Tools: Smatch (1.59)
Entered: 2013-09-11 08:47:26 UTC


Source:

 534        int retval;
 535        struct mpoa_client *mpc;
 536        struct ethhdr *eth;
 537        int i = 0;
 538
 539        mpc = find_mpc_by_lec(dev); /* this should NEVER fail */
 540        if(mpc == NULL) {
 541                printk("mpoa: (%s) mpc_send_packet: no MPC found\n", dev->name);
 542                goto non_ip;
 543        }
 544
 545        eth = (struct ethhdr *)skb->data;
 546        if (eth->h_proto != htons(ETH_P_IP))
 547                goto non_ip; /* Multi-Protocol Over ATM :-) */
 548
 549        /* Weed out funny packets (e.g., AF_PACKET or raw). */
 550        if (skb->len < ETH_HLEN + sizeof(struct iphdr))
 551                goto non_ip;
 552        skb_set_network_header(skb, ETH_HLEN);
 553        if (skb->len < ETH_HLEN + ip_hdr(skb)->ihl * 4 || ip_hdr(skb)->ihl < 5)
 554                goto non_ip;
 555
 556        while (i < mpc->number_of_mps_macs) {
 557                if (!compare_ether_addr(eth->h_dest, (mpc->mps_macs + i*ETH_ALEN)))
 558                        if ( send_via_shortcut(skb, mpc) == 0 )           /* try shortcut */
 559                                return 0;                                 /* success!     */
 560                i++;
 561        }
 562
 563 non_ip:
 564        retval = mpc->old_hard_start_xmit(skb,dev);
 565
 566        return retval;
 567}
 568
 569static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg)
 570{
 571        int bytes_left;
 572        struct mpoa_client *mpc;
 573        struct atmmpc_ioc ioc_data;
 574        in_cache_entry *in_entry;
Show full sources