Showing error 1737

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: drivers/misc/sgi-gru/grumain.c
Line in file: 387
Project: Linux Kernel
Project version: 2.6.28
Tools: Smatch (1.59)
Entered: 2013-09-10 20:24:52 UTC


Source:

357        struct gru_thread_state *gts;
358
359        spin_lock(&vdata->vd_lock);
360        gts = gru_find_current_gts_nolock(vdata, tsid);
361        spin_unlock(&vdata->vd_lock);
362        gru_dbg(grudev, "vma %p, gts %p\n", vma, gts);
363        return gts;
364}
365
366/*
367 * Allocate a new thread state for a GSEG. Note that races may allow
368 * another thread to race to create a gts.
369 */
370struct gru_thread_state *gru_alloc_thread_state(struct vm_area_struct *vma,
371                                        int tsid)
372{
373        struct gru_vma_data *vdata = vma->vm_private_data;
374        struct gru_thread_state *gts, *ngts;
375
376        gts = gru_alloc_gts(vma, vdata, tsid);
377        if (!gts)
378                return NULL;
379
380        spin_lock(&vdata->vd_lock);
381        ngts = gru_find_current_gts_nolock(vdata, tsid);
382        if (ngts) {
383                gts_drop(gts);
384                gts = ngts;
385                STAT(gts_double_allocate);
386        } else {
387                list_add(&gts->ts_next, &vdata->vd_head);
388        }
389        spin_unlock(&vdata->vd_lock);
390        gru_dbg(grudev, "vma %p, gts %p\n", vma, gts);
391        return gts;
392}
393
394/*
395 * Free the GRU context assigned to the thread state.
396 */
397static void gru_free_gru_context(struct gru_thread_state *gts)
Show full sources