dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* re: drm/ttm: Refuse to fault (prime-) imported pages
@ 2016-05-09 19:39 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2016-05-09 19:39 UTC (permalink / raw)
  To: thellstrom; +Cc: dri-devel

Hello Thomas Hellstrom,

The patch 667a50db0477: "drm/ttm: Refuse to fault (prime-) imported
pages" from Jan 3, 2014, leads to the following static checker
warning:

	drivers/gpu/drm/ttm/ttm_bo_vm.c:205 ttm_bo_vm_fault()
	error: we previously assumed 'ttm' could be null (see line 200)

drivers/gpu/drm/ttm/ttm_bo_vm.c
   133          /*
   134           * Refuse to fault imported pages. This should be handled
   135           * (if at all) by redirecting mmap to the exporter.
   136           */
   137          if (bo->ttm && (bo->ttm->page_flags & TTM_PAGE_FLAG_SG)) {
                    ^^^^^^^
New check for NULL.  Is this really needed?

   138                  retval = VM_FAULT_SIGBUS;
   139                  goto out_unlock;
   140          }

[ snip ]

   188          /*
   189           * Make a local vma copy to modify the page_prot member
   190           * and vm_flags if necessary. The vma parameter is protected
   191           * by mmap_sem in write mode.
   192           */
   193          cvma = *vma;
   194          cvma.vm_page_prot = vm_get_page_prot(cvma.vm_flags);
   195  
   196          if (bo->mem.bus.is_iomem) {
   197                  cvma.vm_page_prot = ttm_io_prot(bo->mem.placement,
   198                                                  cvma.vm_page_prot);
   199          } else {
   200                  ttm = bo->ttm;
                        ^^^^^^^^^^^^^
   201                  cvma.vm_page_prot = ttm_io_prot(bo->mem.placement,
   202                                                  cvma.vm_page_prot);
   203  
   204                  /* Allocate all page at once, most common usage */
   205                  if (ttm->bdev->driver->ttm_tt_populate(ttm)) {
                            ^^^^^^^^^
Old unchecked dereference.

   206                          retval = VM_FAULT_OOM;
   207                          goto out_io_unlock;
   208                  }
   209          }
   210  


regards,
dan carpenter
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-05-09 19:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-09 19:39 drm/ttm: Refuse to fault (prime-) imported pages Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox