[PATCH] drm/shmem-helper: Don't remove the offset in vm_area_struct pgoff
kernel test robot
lkp at intel.com
Wed Feb 17 19:33:25 UTC 2021
Hi Neil,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.11 next-20210217]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Neil-Roberts/drm-shmem-helper-Don-t-remove-the-offset-in-vm_area_struct-pgoff/20210218-012028
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git f40ddce88593482919761f74910f42f4b84c004b
config: i386-randconfig-m021-20210215 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>
New smatch warnings:
drivers/gpu/drm/drm_gem_shmem_helper.c:534 drm_gem_shmem_fault() warn: unsigned 'page_offset' is never less than zero.
Old smatch warnings:
include/drm/drm_vma_manager.h:225 drm_vma_node_unmap() warn: should 'drm_vma_node_size(node) << 12' be a 64 bit type?
vim +/page_offset +534 drivers/gpu/drm/drm_gem_shmem_helper.c
521
522 static vm_fault_t drm_gem_shmem_fault(struct vm_fault *vmf)
523 {
524 struct vm_area_struct *vma = vmf->vma;
525 struct drm_gem_object *obj = vma->vm_private_data;
526 struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj);
527 loff_t num_pages = obj->size >> PAGE_SHIFT;
528 struct page *page;
529 pgoff_t page_offset;
530
531 /* We don't use vmf->pgoff since that has the fake offset */
532 page_offset = (vmf->address - vma->vm_start) >> PAGE_SHIFT;
533
> 534 if (page_offset < 0 || page_offset >= num_pages ||
535 WARN_ON_ONCE(!shmem->pages))
536 return VM_FAULT_SIGBUS;
537
538 page = shmem->pages[page_offset];
539
540 return vmf_insert_page(vma, vmf->address, page);
541 }
542
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 38058 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20210218/b45207ee/attachment-0001.gz>
More information about the dri-devel
mailing list