[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202010161530.mhZBhIek-lkp@intel.com>
Date: Fri, 16 Oct 2020 15:34:04 +0800
From: kernel test robot <lkp@...el.com>
To: kiransuren@...osl.org, kirank.suren@...il.com,
gregkh@...uxfoundation.org
Cc: kbuild-all@...ts.01.org, devel@...verdev.osuosl.org,
kiransuren <kirank.suren@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Staging: android: ashmem: changed struct file_operations
to const file_operations
Hi,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on staging/staging-testing]
url: https://github.com/0day-ci/linux/commits/kiransuren-osuosl-org/Staging-android-ashmem-changed-struct-file_operations-to-const-file_operations/20201016-131238
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 726eb70e0d34dc4bc4dada71f52bba8ed638431e
config: x86_64-randconfig-a006-20201016 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 5fbab4025eb57b12f2842ab188ff07a110708e1d)
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
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/1496e5f2103cc6f96af90aaf323cf92f018dcf41
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review kiransuren-osuosl-org/Staging-android-ashmem-changed-struct-file_operations-to-const-file_operations/20201016-131238
git checkout 1496e5f2103cc6f96af90aaf323cf92f018dcf41
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All errors (new ones prefixed by >>):
>> drivers/staging/android/ashmem.c:379:15: error: must use 'struct' tag to refer to type 'file_operations'
static const file_operations vmfile_fops;
^
struct
>> drivers/staging/android/ashmem.c:430:16: error: cannot assign to variable 'vmfile_fops' with const-qualified type 'const struct file_operations'
vmfile_fops = *vmfile->f_op;
~~~~~~~~~~~ ^
drivers/staging/android/ashmem.c:379:31: note: variable 'vmfile_fops' declared const here
static const file_operations vmfile_fops;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
drivers/staging/android/ashmem.c:431:21: error: cannot assign to variable 'vmfile_fops' with const-qualified type 'const struct file_operations'
vmfile_fops.mmap = ashmem_vmfile_mmap;
~~~~~~~~~~~~~~~~ ^
drivers/staging/android/ashmem.c:379:31: note: variable 'vmfile_fops' declared const here
static const file_operations vmfile_fops;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
drivers/staging/android/ashmem.c:432:34: error: cannot assign to variable 'vmfile_fops' with const-qualified type 'const struct file_operations'
vmfile_fops.get_unmapped_area =
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
drivers/staging/android/ashmem.c:379:31: note: variable 'vmfile_fops' declared const here
static const file_operations vmfile_fops;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
4 errors generated.
vim +379 drivers/staging/android/ashmem.c
376
377 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
378 {
> 379 static const file_operations vmfile_fops;
380 struct ashmem_area *asma = file->private_data;
381 int ret = 0;
382
383 mutex_lock(&ashmem_mutex);
384
385 /* user needs to SET_SIZE before mapping */
386 if (!asma->size) {
387 ret = -EINVAL;
388 goto out;
389 }
390
391 /* requested mapping size larger than object size */
392 if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) {
393 ret = -EINVAL;
394 goto out;
395 }
396
397 /* requested protection bits must match our allowed protection mask */
398 if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) &
399 calc_vm_prot_bits(PROT_MASK, 0)) {
400 ret = -EPERM;
401 goto out;
402 }
403 vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask);
404
405 if (!asma->file) {
406 char *name = ASHMEM_NAME_DEF;
407 struct file *vmfile;
408 struct inode *inode;
409
410 if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0')
411 name = asma->name;
412
413 /* ... and allocate the backing shmem file */
414 vmfile = shmem_file_setup(name, asma->size, vma->vm_flags);
415 if (IS_ERR(vmfile)) {
416 ret = PTR_ERR(vmfile);
417 goto out;
418 }
419 vmfile->f_mode |= FMODE_LSEEK;
420 inode = file_inode(vmfile);
421 lockdep_set_class(&inode->i_rwsem, &backing_shmem_inode_class);
422 asma->file = vmfile;
423 /*
424 * override mmap operation of the vmfile so that it can't be
425 * remapped which would lead to creation of a new vma with no
426 * asma permission checks. Have to override get_unmapped_area
427 * as well to prevent VM_BUG_ON check for f_ops modification.
428 */
429 if (!vmfile_fops.mmap) {
> 430 vmfile_fops = *vmfile->f_op;
431 vmfile_fops.mmap = ashmem_vmfile_mmap;
432 vmfile_fops.get_unmapped_area =
433 ashmem_vmfile_get_unmapped_area;
434 }
435 vmfile->f_op = &vmfile_fops;
436 }
437 get_file(asma->file);
438
439 /*
440 * XXX - Reworked to use shmem_zero_setup() instead of
441 * shmem_set_file while we're in staging. -jstultz
442 */
443 if (vma->vm_flags & VM_SHARED) {
444 ret = shmem_zero_setup(vma);
445 if (ret) {
446 fput(asma->file);
447 goto out;
448 }
449 } else {
450 vma_set_anonymous(vma);
451 }
452
453 if (vma->vm_file)
454 fput(vma->vm_file);
455 vma->vm_file = asma->file;
456
457 out:
458 mutex_unlock(&ashmem_mutex);
459 return ret;
460 }
461
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (33882 bytes)
Powered by blists - more mailing lists