From: Dan Carpenter <dan.carpenter@oracle.com>
To: thellstrom@vmware.com
Cc: dri-devel@lists.freedesktop.org
Subject: re: drm/ttm: Refuse to fault (prime-) imported pages
Date: Mon, 9 May 2016 22:39:16 +0300 [thread overview]
Message-ID: <20160509193916.GA22546@mwanda> (raw)
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
reply other threads:[~2016-05-09 19:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160509193916.GA22546@mwanda \
--to=dan.carpenter@oracle.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=thellstrom@vmware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox