Showing error 1797

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


Source:

 383        BUG_ON(dev->cmd.free_head < 0);
 384        context = &dev->cmd.context[dev->cmd.free_head];
 385        context->token += dev->cmd.token_mask + 1;
 386        dev->cmd.free_head = context->next;
 387        spin_unlock(&dev->cmd.context_lock);
 388
 389        init_completion(&context->done);
 390
 391        err = mthca_cmd_post(dev, in_param,
 392                             out_param ? *out_param : 0,
 393                             in_modifier, op_modifier,
 394                             op, context->token, 1);
 395        if (err)
 396                goto out;
 397
 398        if (!wait_for_completion_timeout(&context->done, timeout)) {
 399                err = -EBUSY;
 400                goto out;
 401        }
 402
 403        err = context->result;
 404        if (err)
 405                goto out;
 406
 407        *status = context->status;
 408        if (*status)
 409                mthca_dbg(dev, "Command %02x completed with status %02x\n",
 410                          op, *status);
 411
 412        if (out_is_imm)
 413                *out_param = context->out_param;
 414
 415out:
 416        spin_lock(&dev->cmd.context_lock);
 417        context->next = dev->cmd.free_head;
 418        dev->cmd.free_head = context - dev->cmd.context;
 419        spin_unlock(&dev->cmd.context_lock);
 420
 421        up(&dev->cmd.event_sem);
 422        return err;
 423}
Show full sources