Re: [PATCH 2/2] mm: introduce vma_set_file function

kernel test robot
2020-09-15T09:20:36Z

[-- Attachment #1: Type: text/plain, Size: 3750 bytes --]

Hi "Christian,

I love your patch! Yet something to improve:

[auto build test ERROR on hnaz-linux-mm/master]
[also build test ERROR on drm-intel/for-linux-next drm-tip/drm-tip linus/master v5.9-rc5 next-20200914]
[cannot apply to tegra-drm/drm/tegra/for-next drm-exynos/exynos-drm-next drm/drm-next]
[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/Christian-K-nig/drm-shmem-helpers-revert-Redirect-mmap-for-imported-dma-buf/20200914-222921
base: https://github.com/hnaz/linux-mm master
config: h8300-randconfig-r023-20200914 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=h8300

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

h8300-linux-ld: drivers/dma-buf/dma-buf.o: in function `dma_buf_mmap':
>> drivers/dma-buf/dma-buf.c:1166: undefined reference to `vma_set_file'
>> h8300-linux-ld: drivers/dma-buf/dma-buf.c:1172: undefined reference to `vma_set_file'
h8300-linux-ld: drivers/leds/leds-lp55xx-common.o: in function `devm_led_classdev_register':
include/linux/leds.h:200: undefined reference to `devm_led_classdev_register_ext'

# https://github.com/0day-ci/linux/commit/c558278651bbea7cb67487890a983608764cc7f4
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Christian-K-nig/drm-shmem-helpers-revert-Redirect-mmap-for-imported-dma-buf/20200914-222921
git checkout c558278651bbea7cb67487890a983608764cc7f4
vim +1166 drivers/dma-buf/dma-buf.c

1127
1128
1129 /**
1130 * dma_buf_mmap - Setup up a userspace mmap with the given vma
1131 * @dmabuf: [in] buffer that should back the vma
1132 * @vma: [in] vma for the mmap
1133 * @pgoff: [in] offset in pages where this mmap should start within the
1134 * dma-buf buffer.
1135 *
1136 * This function adjusts the passed in vma so that it points at the file of the
1137 * dma_buf operation. It also adjusts the starting pgoff and does bounds
1138 * checking on the size of the vma. Then it calls the exporters mmap function to
1139 * set up the mapping.
1140 *
1141 * Can return negative error values, returns 0 on success.
1142 */
1143 int dma_buf_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma,
1144 unsigned long pgoff)
1145 {
1146 struct file *oldfile;
1147 int ret;
1148
1149 if (WARN_ON(!dmabuf || !vma))
1150 return -EINVAL;
1151
1152 /* check if buffer supports mmap */
1153 if (!dmabuf->ops->mmap)
1154 return -EINVAL;
1155
1156 /* check for offset overflow */
1157 if (pgoff + vma_pages(vma) < pgoff)
1158 return -EOVERFLOW;
1159
1160 /* check for overflowing the buffer's size */
1161 if (pgoff + vma_pages(vma) >
1162 dmabuf->size >> PAGE_SHIFT)
1163 return -EINVAL;
1164
1165 /* readjust the vma */
> 1166 oldfile = vma_set_file(vma, dmabuf->file);
1167 vma->vm_pgoff = pgoff;
1168
1169 ret = dmabuf->ops->mmap(dmabuf, vma);
1170 /* restore old parameters on failure */
1171 if (ret)
> 1172 vma_set_file(vma, oldfile);
1173
1174 return ret;
1175

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 17778 bytes --]