All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: android: ashmem: Fixed warning for structure declaration
@ 2020-12-27 11:26 ` Angshuman Sengupta
  0 siblings, 0 replies; 7+ messages in thread
From: Angshuman Sengupta @ 2020-12-27 11:26 UTC (permalink / raw)
  Cc: senguptaangshuman17, Greg Kroah-Hartman,
	Arve Hjønnevåg, Todd Kjos, Martijn Coenen,
	Joel Fernandes, Christian Brauner, Hridya Valsaraju,
	Suren Baghdasaryan, devel, linux-kernel

Warning found by checkpatch.pl script.

Signed-off-by: Angshuman Sengupta <senguptaangshuman17@gmail.com>
---
 drivers/staging/android/ashmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index 4789d36ddfd3..2cb665e0228c 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -376,7 +376,7 @@ ashmem_vmfile_get_unmapped_area(struct file *file, unsigned long addr,
 
 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
 {
-	static struct file_operations vmfile_fops;
+	static const struct file_operations vmfile_fops;
 	struct ashmem_area *asma = file->private_data;
 	int ret = 0;
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] staging: android: ashmem: Fixed warning for structure declaration
@ 2020-12-27 11:26 ` Angshuman Sengupta
  0 siblings, 0 replies; 7+ messages in thread
From: Angshuman Sengupta @ 2020-12-27 11:26 UTC (permalink / raw)
  Cc: devel, Todd Kjos, Greg Kroah-Hartman, linux-kernel,
	Suren Baghdasaryan, Hridya Valsaraju, Arve Hjønnevåg,
	Joel Fernandes, Martijn Coenen, senguptaangshuman17,
	Christian Brauner

Warning found by checkpatch.pl script.

Signed-off-by: Angshuman Sengupta <senguptaangshuman17@gmail.com>
---
 drivers/staging/android/ashmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index 4789d36ddfd3..2cb665e0228c 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -376,7 +376,7 @@ ashmem_vmfile_get_unmapped_area(struct file *file, unsigned long addr,
 
 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
 {
-	static struct file_operations vmfile_fops;
+	static const struct file_operations vmfile_fops;
 	struct ashmem_area *asma = file->private_data;
 	int ret = 0;
 
-- 
2.29.2

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] staging: android: ashmem: Fixed warning for structure declaration
  2020-12-27 11:26 ` Angshuman Sengupta
@ 2020-12-27 11:40   ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2020-12-27 11:40 UTC (permalink / raw)
  To: Angshuman Sengupta
  Cc: devel, Todd Kjos, linux-kernel, Suren Baghdasaryan,
	Hridya Valsaraju, Arve Hjønnevåg, Joel Fernandes,
	Martijn Coenen, Christian Brauner

On Sun, Dec 27, 2020 at 04:56:45PM +0530, Angshuman Sengupta wrote:
> Warning found by checkpatch.pl script.
> 
> Signed-off-by: Angshuman Sengupta <senguptaangshuman17@gmail.com>
> ---
>  drivers/staging/android/ashmem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
> index 4789d36ddfd3..2cb665e0228c 100644
> --- a/drivers/staging/android/ashmem.c
> +++ b/drivers/staging/android/ashmem.c
> @@ -376,7 +376,7 @@ ashmem_vmfile_get_unmapped_area(struct file *file, unsigned long addr,
>  
>  static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
>  {
> -	static struct file_operations vmfile_fops;
> +	static const struct file_operations vmfile_fops;
>  	struct ashmem_area *asma = file->private_data;
>  	int ret = 0;
>  

Did you test build this change?  Why not?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] staging: android: ashmem: Fixed warning for structure declaration
@ 2020-12-27 11:40   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2020-12-27 11:40 UTC (permalink / raw)
  To: Angshuman Sengupta
  Cc: devel, Todd Kjos, Martijn Coenen, linux-kernel, Joel Fernandes,
	Arve Hjønnevåg, Hridya Valsaraju, Suren Baghdasaryan,
	Christian Brauner

On Sun, Dec 27, 2020 at 04:56:45PM +0530, Angshuman Sengupta wrote:
> Warning found by checkpatch.pl script.
> 
> Signed-off-by: Angshuman Sengupta <senguptaangshuman17@gmail.com>
> ---
>  drivers/staging/android/ashmem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
> index 4789d36ddfd3..2cb665e0228c 100644
> --- a/drivers/staging/android/ashmem.c
> +++ b/drivers/staging/android/ashmem.c
> @@ -376,7 +376,7 @@ ashmem_vmfile_get_unmapped_area(struct file *file, unsigned long addr,
>  
>  static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
>  {
> -	static struct file_operations vmfile_fops;
> +	static const struct file_operations vmfile_fops;
>  	struct ashmem_area *asma = file->private_data;
>  	int ret = 0;
>  

Did you test build this change?  Why not?

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] staging: android: ashmem: Fixed warning for structure declaration
  2020-12-27 11:26 ` Angshuman Sengupta
  (?)
@ 2020-12-29  2:29   ` kernel test robot
  -1 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2020-12-29  2:29 UTC (permalink / raw)
  To: Angshuman Sengupta
  Cc: kbuild-all, devel, Todd Kjos, Greg Kroah-Hartman, linux-kernel,
	Suren Baghdasaryan, Hridya Valsaraju, Arve Hjønnevåg,
	Joel Fernandes, Martijn Coenen, senguptaangshuman17

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

Hi Angshuman,

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/Angshuman-Sengupta/staging-android-ashmem-Fixed-warning-for-structure-declaration/20201227-192757
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 5e60366d56c630e32befce7ef05c569e04391ca3
config: mips-randconfig-r004-20201227 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
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 mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://github.com/0day-ci/linux/commit/f29b5812159ea6f79fe84fe78780012627211da1
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Angshuman-Sengupta/staging-android-ashmem-Fixed-warning-for-structure-declaration/20201227-192757
        git checkout f29b5812159ea6f79fe84fe78780012627211da1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 

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 >>):

>> 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:38: note: variable 'vmfile_fops' declared const here
           static const struct 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:38: note: variable 'vmfile_fops' declared const here
           static const struct 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:38: note: variable 'vmfile_fops' declared const here
           static const struct file_operations vmfile_fops;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
   3 errors generated.


vim +430 drivers/staging/android/ashmem.c

6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  376  
11980c2ac4ccfad Robert Love        2011-12-20  377  static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
11980c2ac4ccfad Robert Love        2011-12-20  378  {
f29b5812159ea6f Angshuman Sengupta 2020-12-27  379  	static const struct file_operations vmfile_fops;
11980c2ac4ccfad Robert Love        2011-12-20  380  	struct ashmem_area *asma = file->private_data;
11980c2ac4ccfad Robert Love        2011-12-20  381  	int ret = 0;
11980c2ac4ccfad Robert Love        2011-12-20  382  
11980c2ac4ccfad Robert Love        2011-12-20  383  	mutex_lock(&ashmem_mutex);
11980c2ac4ccfad Robert Love        2011-12-20  384  
11980c2ac4ccfad Robert Love        2011-12-20  385  	/* user needs to SET_SIZE before mapping */
59848d6aded59a6 Alistair Strachan  2018-06-19  386  	if (!asma->size) {
11980c2ac4ccfad Robert Love        2011-12-20  387  		ret = -EINVAL;
11980c2ac4ccfad Robert Love        2011-12-20  388  		goto out;
11980c2ac4ccfad Robert Love        2011-12-20  389  	}
11980c2ac4ccfad Robert Love        2011-12-20  390  
8632c614565d0c5 Alistair Strachan  2018-06-19  391  	/* requested mapping size larger than object size */
8632c614565d0c5 Alistair Strachan  2018-06-19  392  	if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) {
11980c2ac4ccfad Robert Love        2011-12-20  393  		ret = -EINVAL;
11980c2ac4ccfad Robert Love        2011-12-20  394  		goto out;
11980c2ac4ccfad Robert Love        2011-12-20  395  	}
11980c2ac4ccfad Robert Love        2011-12-20  396  
11980c2ac4ccfad Robert Love        2011-12-20  397  	/* requested protection bits must match our allowed protection mask */
59848d6aded59a6 Alistair Strachan  2018-06-19  398  	if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) &
59848d6aded59a6 Alistair Strachan  2018-06-19  399  	    calc_vm_prot_bits(PROT_MASK, 0)) {
11980c2ac4ccfad Robert Love        2011-12-20  400  		ret = -EPERM;
11980c2ac4ccfad Robert Love        2011-12-20  401  		goto out;
11980c2ac4ccfad Robert Love        2011-12-20  402  	}
56f76fc68492af7 Arve Hjønnevåg     2011-12-20  403  	vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask);
11980c2ac4ccfad Robert Love        2011-12-20  404  
11980c2ac4ccfad Robert Love        2011-12-20  405  	if (!asma->file) {
11980c2ac4ccfad Robert Love        2011-12-20  406  		char *name = ASHMEM_NAME_DEF;
11980c2ac4ccfad Robert Love        2011-12-20  407  		struct file *vmfile;
3e338d3c95c735d Suren Baghdasaryan 2020-07-30  408  		struct inode *inode;
11980c2ac4ccfad Robert Love        2011-12-20  409  
11980c2ac4ccfad Robert Love        2011-12-20  410  		if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0')
11980c2ac4ccfad Robert Love        2011-12-20  411  			name = asma->name;
11980c2ac4ccfad Robert Love        2011-12-20  412  
11980c2ac4ccfad Robert Love        2011-12-20  413  		/* ... and allocate the backing shmem file */
11980c2ac4ccfad Robert Love        2011-12-20  414  		vmfile = shmem_file_setup(name, asma->size, vma->vm_flags);
7f44cb0ba88b40c Viresh Kumar       2015-07-31  415  		if (IS_ERR(vmfile)) {
11980c2ac4ccfad Robert Love        2011-12-20  416  			ret = PTR_ERR(vmfile);
11980c2ac4ccfad Robert Love        2011-12-20  417  			goto out;
11980c2ac4ccfad Robert Love        2011-12-20  418  		}
97fbfef6bd59788 Shuxiao Zhang      2017-04-06  419  		vmfile->f_mode |= FMODE_LSEEK;
3e338d3c95c735d Suren Baghdasaryan 2020-07-30  420  		inode = file_inode(vmfile);
3e338d3c95c735d Suren Baghdasaryan 2020-07-30  421  		lockdep_set_class(&inode->i_rwsem, &backing_shmem_inode_class);
11980c2ac4ccfad Robert Love        2011-12-20  422  		asma->file = vmfile;
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  423  		/*
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  424  		 * override mmap operation of the vmfile so that it can't be
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  425  		 * remapped which would lead to creation of a new vma with no
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  426  		 * asma permission checks. Have to override get_unmapped_area
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  427  		 * as well to prevent VM_BUG_ON check for f_ops modification.
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  428  		 */
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  429  		if (!vmfile_fops.mmap) {
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27 @430  			vmfile_fops = *vmfile->f_op;
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  431  			vmfile_fops.mmap = ashmem_vmfile_mmap;
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  432  			vmfile_fops.get_unmapped_area =
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  433  					ashmem_vmfile_get_unmapped_area;
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  434  		}
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  435  		vmfile->f_op = &vmfile_fops;
11980c2ac4ccfad Robert Love        2011-12-20  436  	}
11980c2ac4ccfad Robert Love        2011-12-20  437  	get_file(asma->file);
11980c2ac4ccfad Robert Love        2011-12-20  438  
11980c2ac4ccfad Robert Love        2011-12-20  439  	/*
11980c2ac4ccfad Robert Love        2011-12-20  440  	 * XXX - Reworked to use shmem_zero_setup() instead of
11980c2ac4ccfad Robert Love        2011-12-20  441  	 * shmem_set_file while we're in staging. -jstultz
11980c2ac4ccfad Robert Love        2011-12-20  442  	 */
11980c2ac4ccfad Robert Love        2011-12-20  443  	if (vma->vm_flags & VM_SHARED) {
11980c2ac4ccfad Robert Love        2011-12-20  444  		ret = shmem_zero_setup(vma);
11980c2ac4ccfad Robert Love        2011-12-20  445  		if (ret) {
11980c2ac4ccfad Robert Love        2011-12-20  446  			fput(asma->file);
11980c2ac4ccfad Robert Love        2011-12-20  447  			goto out;
11980c2ac4ccfad Robert Love        2011-12-20  448  		}
44960f2a7b63e22 John Stultz        2018-07-31  449  	} else {
44960f2a7b63e22 John Stultz        2018-07-31  450  		vma_set_anonymous(vma);
11980c2ac4ccfad Robert Love        2011-12-20  451  	}
11980c2ac4ccfad Robert Love        2011-12-20  452  
11980c2ac4ccfad Robert Love        2011-12-20  453  	if (vma->vm_file)
11980c2ac4ccfad Robert Love        2011-12-20  454  		fput(vma->vm_file);
11980c2ac4ccfad Robert Love        2011-12-20  455  	vma->vm_file = asma->file;
11980c2ac4ccfad Robert Love        2011-12-20  456  
11980c2ac4ccfad Robert Love        2011-12-20  457  out:
11980c2ac4ccfad Robert Love        2011-12-20  458  	mutex_unlock(&ashmem_mutex);
11980c2ac4ccfad Robert Love        2011-12-20  459  	return ret;
11980c2ac4ccfad Robert Love        2011-12-20  460  }
11980c2ac4ccfad Robert Love        2011-12-20  461  

---
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: 33298 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] staging: android: ashmem: Fixed warning for structure declaration
@ 2020-12-29  2:29   ` kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2020-12-29  2:29 UTC (permalink / raw)
  To: Angshuman Sengupta
  Cc: devel, Todd Kjos, Greg Kroah-Hartman, linux-kernel,
	Joel Fernandes, Arve Hjønnevåg, Martijn Coenen,
	Hridya Valsaraju, kbuild-all, Suren Baghdasaryan,
	senguptaangshuman17

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

Hi Angshuman,

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/Angshuman-Sengupta/staging-android-ashmem-Fixed-warning-for-structure-declaration/20201227-192757
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 5e60366d56c630e32befce7ef05c569e04391ca3
config: mips-randconfig-r004-20201227 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
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 mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://github.com/0day-ci/linux/commit/f29b5812159ea6f79fe84fe78780012627211da1
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Angshuman-Sengupta/staging-android-ashmem-Fixed-warning-for-structure-declaration/20201227-192757
        git checkout f29b5812159ea6f79fe84fe78780012627211da1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 

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 >>):

>> 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:38: note: variable 'vmfile_fops' declared const here
           static const struct 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:38: note: variable 'vmfile_fops' declared const here
           static const struct 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:38: note: variable 'vmfile_fops' declared const here
           static const struct file_operations vmfile_fops;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
   3 errors generated.


vim +430 drivers/staging/android/ashmem.c

6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  376  
11980c2ac4ccfad Robert Love        2011-12-20  377  static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
11980c2ac4ccfad Robert Love        2011-12-20  378  {
f29b5812159ea6f Angshuman Sengupta 2020-12-27  379  	static const struct file_operations vmfile_fops;
11980c2ac4ccfad Robert Love        2011-12-20  380  	struct ashmem_area *asma = file->private_data;
11980c2ac4ccfad Robert Love        2011-12-20  381  	int ret = 0;
11980c2ac4ccfad Robert Love        2011-12-20  382  
11980c2ac4ccfad Robert Love        2011-12-20  383  	mutex_lock(&ashmem_mutex);
11980c2ac4ccfad Robert Love        2011-12-20  384  
11980c2ac4ccfad Robert Love        2011-12-20  385  	/* user needs to SET_SIZE before mapping */
59848d6aded59a6 Alistair Strachan  2018-06-19  386  	if (!asma->size) {
11980c2ac4ccfad Robert Love        2011-12-20  387  		ret = -EINVAL;
11980c2ac4ccfad Robert Love        2011-12-20  388  		goto out;
11980c2ac4ccfad Robert Love        2011-12-20  389  	}
11980c2ac4ccfad Robert Love        2011-12-20  390  
8632c614565d0c5 Alistair Strachan  2018-06-19  391  	/* requested mapping size larger than object size */
8632c614565d0c5 Alistair Strachan  2018-06-19  392  	if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) {
11980c2ac4ccfad Robert Love        2011-12-20  393  		ret = -EINVAL;
11980c2ac4ccfad Robert Love        2011-12-20  394  		goto out;
11980c2ac4ccfad Robert Love        2011-12-20  395  	}
11980c2ac4ccfad Robert Love        2011-12-20  396  
11980c2ac4ccfad Robert Love        2011-12-20  397  	/* requested protection bits must match our allowed protection mask */
59848d6aded59a6 Alistair Strachan  2018-06-19  398  	if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) &
59848d6aded59a6 Alistair Strachan  2018-06-19  399  	    calc_vm_prot_bits(PROT_MASK, 0)) {
11980c2ac4ccfad Robert Love        2011-12-20  400  		ret = -EPERM;
11980c2ac4ccfad Robert Love        2011-12-20  401  		goto out;
11980c2ac4ccfad Robert Love        2011-12-20  402  	}
56f76fc68492af7 Arve Hjønnevåg     2011-12-20  403  	vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask);
11980c2ac4ccfad Robert Love        2011-12-20  404  
11980c2ac4ccfad Robert Love        2011-12-20  405  	if (!asma->file) {
11980c2ac4ccfad Robert Love        2011-12-20  406  		char *name = ASHMEM_NAME_DEF;
11980c2ac4ccfad Robert Love        2011-12-20  407  		struct file *vmfile;
3e338d3c95c735d Suren Baghdasaryan 2020-07-30  408  		struct inode *inode;
11980c2ac4ccfad Robert Love        2011-12-20  409  
11980c2ac4ccfad Robert Love        2011-12-20  410  		if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0')
11980c2ac4ccfad Robert Love        2011-12-20  411  			name = asma->name;
11980c2ac4ccfad Robert Love        2011-12-20  412  
11980c2ac4ccfad Robert Love        2011-12-20  413  		/* ... and allocate the backing shmem file */
11980c2ac4ccfad Robert Love        2011-12-20  414  		vmfile = shmem_file_setup(name, asma->size, vma->vm_flags);
7f44cb0ba88b40c Viresh Kumar       2015-07-31  415  		if (IS_ERR(vmfile)) {
11980c2ac4ccfad Robert Love        2011-12-20  416  			ret = PTR_ERR(vmfile);
11980c2ac4ccfad Robert Love        2011-12-20  417  			goto out;
11980c2ac4ccfad Robert Love        2011-12-20  418  		}
97fbfef6bd59788 Shuxiao Zhang      2017-04-06  419  		vmfile->f_mode |= FMODE_LSEEK;
3e338d3c95c735d Suren Baghdasaryan 2020-07-30  420  		inode = file_inode(vmfile);
3e338d3c95c735d Suren Baghdasaryan 2020-07-30  421  		lockdep_set_class(&inode->i_rwsem, &backing_shmem_inode_class);
11980c2ac4ccfad Robert Love        2011-12-20  422  		asma->file = vmfile;
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  423  		/*
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  424  		 * override mmap operation of the vmfile so that it can't be
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  425  		 * remapped which would lead to creation of a new vma with no
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  426  		 * asma permission checks. Have to override get_unmapped_area
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  427  		 * as well to prevent VM_BUG_ON check for f_ops modification.
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  428  		 */
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  429  		if (!vmfile_fops.mmap) {
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27 @430  			vmfile_fops = *vmfile->f_op;
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  431  			vmfile_fops.mmap = ashmem_vmfile_mmap;
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  432  			vmfile_fops.get_unmapped_area =
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  433  					ashmem_vmfile_get_unmapped_area;
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  434  		}
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  435  		vmfile->f_op = &vmfile_fops;
11980c2ac4ccfad Robert Love        2011-12-20  436  	}
11980c2ac4ccfad Robert Love        2011-12-20  437  	get_file(asma->file);
11980c2ac4ccfad Robert Love        2011-12-20  438  
11980c2ac4ccfad Robert Love        2011-12-20  439  	/*
11980c2ac4ccfad Robert Love        2011-12-20  440  	 * XXX - Reworked to use shmem_zero_setup() instead of
11980c2ac4ccfad Robert Love        2011-12-20  441  	 * shmem_set_file while we're in staging. -jstultz
11980c2ac4ccfad Robert Love        2011-12-20  442  	 */
11980c2ac4ccfad Robert Love        2011-12-20  443  	if (vma->vm_flags & VM_SHARED) {
11980c2ac4ccfad Robert Love        2011-12-20  444  		ret = shmem_zero_setup(vma);
11980c2ac4ccfad Robert Love        2011-12-20  445  		if (ret) {
11980c2ac4ccfad Robert Love        2011-12-20  446  			fput(asma->file);
11980c2ac4ccfad Robert Love        2011-12-20  447  			goto out;
11980c2ac4ccfad Robert Love        2011-12-20  448  		}
44960f2a7b63e22 John Stultz        2018-07-31  449  	} else {
44960f2a7b63e22 John Stultz        2018-07-31  450  		vma_set_anonymous(vma);
11980c2ac4ccfad Robert Love        2011-12-20  451  	}
11980c2ac4ccfad Robert Love        2011-12-20  452  
11980c2ac4ccfad Robert Love        2011-12-20  453  	if (vma->vm_file)
11980c2ac4ccfad Robert Love        2011-12-20  454  		fput(vma->vm_file);
11980c2ac4ccfad Robert Love        2011-12-20  455  	vma->vm_file = asma->file;
11980c2ac4ccfad Robert Love        2011-12-20  456  
11980c2ac4ccfad Robert Love        2011-12-20  457  out:
11980c2ac4ccfad Robert Love        2011-12-20  458  	mutex_unlock(&ashmem_mutex);
11980c2ac4ccfad Robert Love        2011-12-20  459  	return ret;
11980c2ac4ccfad Robert Love        2011-12-20  460  }
11980c2ac4ccfad Robert Love        2011-12-20  461  

---
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: 33298 bytes --]

[-- Attachment #3: Type: text/plain, Size: 169 bytes --]

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] staging: android: ashmem: Fixed warning for structure declaration
@ 2020-12-29  2:29   ` kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2020-12-29  2:29 UTC (permalink / raw)
  To: kbuild-all

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

Hi Angshuman,

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/Angshuman-Sengupta/staging-android-ashmem-Fixed-warning-for-structure-declaration/20201227-192757
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 5e60366d56c630e32befce7ef05c569e04391ca3
config: mips-randconfig-r004-20201227 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project cee1e7d14f4628d6174b33640d502bff3b54ae45)
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 mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://github.com/0day-ci/linux/commit/f29b5812159ea6f79fe84fe78780012627211da1
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Angshuman-Sengupta/staging-android-ashmem-Fixed-warning-for-structure-declaration/20201227-192757
        git checkout f29b5812159ea6f79fe84fe78780012627211da1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 

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 >>):

>> 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:38: note: variable 'vmfile_fops' declared const here
           static const struct 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:38: note: variable 'vmfile_fops' declared const here
           static const struct 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:38: note: variable 'vmfile_fops' declared const here
           static const struct file_operations vmfile_fops;
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
   3 errors generated.


vim +430 drivers/staging/android/ashmem.c

6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  376  
11980c2ac4ccfad Robert Love        2011-12-20  377  static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
11980c2ac4ccfad Robert Love        2011-12-20  378  {
f29b5812159ea6f Angshuman Sengupta 2020-12-27  379  	static const struct file_operations vmfile_fops;
11980c2ac4ccfad Robert Love        2011-12-20  380  	struct ashmem_area *asma = file->private_data;
11980c2ac4ccfad Robert Love        2011-12-20  381  	int ret = 0;
11980c2ac4ccfad Robert Love        2011-12-20  382  
11980c2ac4ccfad Robert Love        2011-12-20  383  	mutex_lock(&ashmem_mutex);
11980c2ac4ccfad Robert Love        2011-12-20  384  
11980c2ac4ccfad Robert Love        2011-12-20  385  	/* user needs to SET_SIZE before mapping */
59848d6aded59a6 Alistair Strachan  2018-06-19  386  	if (!asma->size) {
11980c2ac4ccfad Robert Love        2011-12-20  387  		ret = -EINVAL;
11980c2ac4ccfad Robert Love        2011-12-20  388  		goto out;
11980c2ac4ccfad Robert Love        2011-12-20  389  	}
11980c2ac4ccfad Robert Love        2011-12-20  390  
8632c614565d0c5 Alistair Strachan  2018-06-19  391  	/* requested mapping size larger than object size */
8632c614565d0c5 Alistair Strachan  2018-06-19  392  	if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) {
11980c2ac4ccfad Robert Love        2011-12-20  393  		ret = -EINVAL;
11980c2ac4ccfad Robert Love        2011-12-20  394  		goto out;
11980c2ac4ccfad Robert Love        2011-12-20  395  	}
11980c2ac4ccfad Robert Love        2011-12-20  396  
11980c2ac4ccfad Robert Love        2011-12-20  397  	/* requested protection bits must match our allowed protection mask */
59848d6aded59a6 Alistair Strachan  2018-06-19  398  	if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) &
59848d6aded59a6 Alistair Strachan  2018-06-19  399  	    calc_vm_prot_bits(PROT_MASK, 0)) {
11980c2ac4ccfad Robert Love        2011-12-20  400  		ret = -EPERM;
11980c2ac4ccfad Robert Love        2011-12-20  401  		goto out;
11980c2ac4ccfad Robert Love        2011-12-20  402  	}
56f76fc68492af7 Arve Hjønnevåg     2011-12-20  403  	vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask);
11980c2ac4ccfad Robert Love        2011-12-20  404  
11980c2ac4ccfad Robert Love        2011-12-20  405  	if (!asma->file) {
11980c2ac4ccfad Robert Love        2011-12-20  406  		char *name = ASHMEM_NAME_DEF;
11980c2ac4ccfad Robert Love        2011-12-20  407  		struct file *vmfile;
3e338d3c95c735d Suren Baghdasaryan 2020-07-30  408  		struct inode *inode;
11980c2ac4ccfad Robert Love        2011-12-20  409  
11980c2ac4ccfad Robert Love        2011-12-20  410  		if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0')
11980c2ac4ccfad Robert Love        2011-12-20  411  			name = asma->name;
11980c2ac4ccfad Robert Love        2011-12-20  412  
11980c2ac4ccfad Robert Love        2011-12-20  413  		/* ... and allocate the backing shmem file */
11980c2ac4ccfad Robert Love        2011-12-20  414  		vmfile = shmem_file_setup(name, asma->size, vma->vm_flags);
7f44cb0ba88b40c Viresh Kumar       2015-07-31  415  		if (IS_ERR(vmfile)) {
11980c2ac4ccfad Robert Love        2011-12-20  416  			ret = PTR_ERR(vmfile);
11980c2ac4ccfad Robert Love        2011-12-20  417  			goto out;
11980c2ac4ccfad Robert Love        2011-12-20  418  		}
97fbfef6bd59788 Shuxiao Zhang      2017-04-06  419  		vmfile->f_mode |= FMODE_LSEEK;
3e338d3c95c735d Suren Baghdasaryan 2020-07-30  420  		inode = file_inode(vmfile);
3e338d3c95c735d Suren Baghdasaryan 2020-07-30  421  		lockdep_set_class(&inode->i_rwsem, &backing_shmem_inode_class);
11980c2ac4ccfad Robert Love        2011-12-20  422  		asma->file = vmfile;
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  423  		/*
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  424  		 * override mmap operation of the vmfile so that it can't be
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  425  		 * remapped which would lead to creation of a new vma with no
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  426  		 * asma permission checks. Have to override get_unmapped_area
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  427  		 * as well to prevent VM_BUG_ON check for f_ops modification.
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  428  		 */
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  429  		if (!vmfile_fops.mmap) {
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27 @430  			vmfile_fops = *vmfile->f_op;
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  431  			vmfile_fops.mmap = ashmem_vmfile_mmap;
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  432  			vmfile_fops.get_unmapped_area =
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  433  					ashmem_vmfile_get_unmapped_area;
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  434  		}
6d67b0290b4b84c Suren Baghdasaryan 2020-01-27  435  		vmfile->f_op = &vmfile_fops;
11980c2ac4ccfad Robert Love        2011-12-20  436  	}
11980c2ac4ccfad Robert Love        2011-12-20  437  	get_file(asma->file);
11980c2ac4ccfad Robert Love        2011-12-20  438  
11980c2ac4ccfad Robert Love        2011-12-20  439  	/*
11980c2ac4ccfad Robert Love        2011-12-20  440  	 * XXX - Reworked to use shmem_zero_setup() instead of
11980c2ac4ccfad Robert Love        2011-12-20  441  	 * shmem_set_file while we're in staging. -jstultz
11980c2ac4ccfad Robert Love        2011-12-20  442  	 */
11980c2ac4ccfad Robert Love        2011-12-20  443  	if (vma->vm_flags & VM_SHARED) {
11980c2ac4ccfad Robert Love        2011-12-20  444  		ret = shmem_zero_setup(vma);
11980c2ac4ccfad Robert Love        2011-12-20  445  		if (ret) {
11980c2ac4ccfad Robert Love        2011-12-20  446  			fput(asma->file);
11980c2ac4ccfad Robert Love        2011-12-20  447  			goto out;
11980c2ac4ccfad Robert Love        2011-12-20  448  		}
44960f2a7b63e22 John Stultz        2018-07-31  449  	} else {
44960f2a7b63e22 John Stultz        2018-07-31  450  		vma_set_anonymous(vma);
11980c2ac4ccfad Robert Love        2011-12-20  451  	}
11980c2ac4ccfad Robert Love        2011-12-20  452  
11980c2ac4ccfad Robert Love        2011-12-20  453  	if (vma->vm_file)
11980c2ac4ccfad Robert Love        2011-12-20  454  		fput(vma->vm_file);
11980c2ac4ccfad Robert Love        2011-12-20  455  	vma->vm_file = asma->file;
11980c2ac4ccfad Robert Love        2011-12-20  456  
11980c2ac4ccfad Robert Love        2011-12-20  457  out:
11980c2ac4ccfad Robert Love        2011-12-20  458  	mutex_unlock(&ashmem_mutex);
11980c2ac4ccfad Robert Love        2011-12-20  459  	return ret;
11980c2ac4ccfad Robert Love        2011-12-20  460  }
11980c2ac4ccfad Robert Love        2011-12-20  461  

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

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-12-29  2:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-27 11:26 [PATCH] staging: android: ashmem: Fixed warning for structure declaration Angshuman Sengupta
2020-12-27 11:26 ` Angshuman Sengupta
2020-12-27 11:40 ` Greg Kroah-Hartman
2020-12-27 11:40   ` Greg Kroah-Hartman
2020-12-29  2:29 ` kernel test robot
2020-12-29  2:29   ` kernel test robot
2020-12-29  2:29   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.