Showing error 1910

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_av.c
Line in file: 199
Project: Linux Kernel
Project version: 2.6.28
Tools: Cppcheck (1.59)
Entered: 2013-10-17 18:38:34 UTC


Source:

169                av       = ah->av;
170        } else if (!atomic_read(&pd->sqp_count) &&
171                 !(dev->mthca_flags & MTHCA_FLAG_DDR_HIDDEN)) {
172                index = mthca_alloc(&dev->av_table.alloc);
173
174                /* fall back to allocate in host memory */
175                if (index == -1)
176                        goto on_hca_fail;
177
178                av = kmalloc(sizeof *av, GFP_ATOMIC);
179                if (!av)
180                        goto on_hca_fail;
181
182                ah->type = MTHCA_AH_ON_HCA;
183                ah->avdma  = dev->av_table.ddr_av_base +
184                        index * MTHCA_AV_SIZE;
185        }
186
187on_hca_fail:
188        if (ah->type == MTHCA_AH_PCI_POOL) {
189                ah->av = pci_pool_alloc(dev->av_table.pool,
190                                        GFP_ATOMIC, &ah->avdma);
191                if (!ah->av)
192                        return -ENOMEM;
193
194                av = ah->av;
195        }
196
197        ah->key = pd->ntmr.ibmr.lkey;
198
199        memset(av, 0, MTHCA_AV_SIZE);
200
201        av->port_pd = cpu_to_be32(pd->pd_num | (ah_attr->port_num << 24));
202        av->g_slid  = ah_attr->src_path_bits;
203        av->dlid    = cpu_to_be16(ah_attr->dlid);
204        av->msg_sr  = (3 << 4) | /* 2K message */
205                mthca_get_rate(dev, ah_attr->static_rate, ah_attr->port_num);
206        av->sl_tclass_flowlabel = cpu_to_be32(ah_attr->sl << 28);
207        if (ah_attr->ah_flags & IB_AH_GRH) {
208                av->g_slid |= 0x80;
209                av->gid_index = (ah_attr->port_num - 1) * dev->limits.gid_table_len +
Show full sources