Showing error 1884

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


Source:

 324                if (dev == NULL) {
 325                        mutex_unlock(&econet_mutex);
 326                        return -ENETDOWN;
 327                }
 328        }
 329
 330        if (len + 15 > dev->mtu) {
 331                mutex_unlock(&econet_mutex);
 332                return -EMSGSIZE;
 333        }
 334
 335        if (dev->type == ARPHRD_ECONET) {
 336                /* Real hardware Econet.  We're not worthy etc. */
 337#ifdef CONFIG_ECONET_NATIVE
 338                unsigned short proto = 0;
 339                int res;
 340
 341                dev_hold(dev);
 342
 343                skb = sock_alloc_send_skb(sk, len+LL_ALLOCATED_SPACE(dev),
 344                                          msg->msg_flags & MSG_DONTWAIT, &err);
 345                if (skb==NULL)
 346                        goto out_unlock;
 347
 348                skb_reserve(skb, LL_RESERVED_SPACE(dev));
 349                skb_reset_network_header(skb);
 350
 351                eb = (struct ec_cb *)&skb->cb;
 352
 353                /* BUG: saddr may be NULL */
 354                eb->cookie = saddr->cookie;
 355                eb->sec = *saddr;
 356                eb->sent = ec_tx_done;
 357
 358                err = -EINVAL;
 359                res = dev_hard_header(skb, dev, ntohs(proto), &addr, NULL, len);
 360                if (res < 0)
 361                        goto out_free;
 362                if (res > 0) {
 363                        struct ec_framehdr *fh;
 364                        /* Poke in our control byte and
Show full sources