* [PATCH] staging: android: ashmem: Declared file operation with const keyword
@ 2020-12-28 5:13 ` jovin555
0 siblings, 0 replies; 36+ messages in thread
From: jovin555 @ 2020-12-28 5:13 UTC (permalink / raw)
Cc: jovin555, Greg Kroah-Hartman, Arve Hjønnevåg,
Todd Kjos, Martijn Coenen, Joel Fernandes, Christian Brauner,
devel, linux-kernel
Warning found by checkpatch.pl script.
Signed-off-by: jovin555 <jovin555@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 c05a214191da..f9cfa15b785f 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -367,7 +367,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.20.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH] staging: android: ashmem: Declared file operation with const keyword
@ 2020-12-28 5:13 ` jovin555
0 siblings, 0 replies; 36+ messages in thread
From: jovin555 @ 2020-12-28 5:13 UTC (permalink / raw)
Cc: devel, jovin555, Todd Kjos, Greg Kroah-Hartman, linux-kernel,
Arve Hjønnevåg, Joel Fernandes, Martijn Coenen,
Christian Brauner
Warning found by checkpatch.pl script.
Signed-off-by: jovin555 <jovin555@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 c05a214191da..f9cfa15b785f 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -367,7 +367,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.20.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with const keyword
2020-12-28 5:13 ` jovin555
@ 2020-12-28 6:35 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 36+ messages in thread
From: Greg Kroah-Hartman @ 2020-12-28 6:35 UTC (permalink / raw)
To: jovin555
Cc: devel, Todd Kjos, linux-kernel, Arve Hjønnevåg,
Joel Fernandes, Martijn Coenen, Christian Brauner
On Mon, Dec 28, 2020 at 12:13:00AM -0500, jovin555 wrote:
> Warning found by checkpatch.pl script.
>
> Signed-off-by: jovin555 <jovin555@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 c05a214191da..f9cfa15b785f 100644
> --- a/drivers/staging/android/ashmem.c
> +++ b/drivers/staging/android/ashmem.c
> @@ -367,7 +367,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 build your modified kernel with this change in it?
Always do so...
greg k-h
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with const keyword
@ 2020-12-28 6:35 ` Greg Kroah-Hartman
0 siblings, 0 replies; 36+ messages in thread
From: Greg Kroah-Hartman @ 2020-12-28 6:35 UTC (permalink / raw)
To: jovin555
Cc: devel, Todd Kjos, linux-kernel, Arve Hjønnevåg,
Joel Fernandes, Martijn Coenen, Christian Brauner
On Mon, Dec 28, 2020 at 12:13:00AM -0500, jovin555 wrote:
> Warning found by checkpatch.pl script.
>
> Signed-off-by: jovin555 <jovin555@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 c05a214191da..f9cfa15b785f 100644
> --- a/drivers/staging/android/ashmem.c
> +++ b/drivers/staging/android/ashmem.c
> @@ -367,7 +367,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 build your modified kernel with this change in it?
Always do so...
greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with const keyword
2020-12-28 5:13 ` jovin555
@ 2021-01-05 11:52 ` Dan Carpenter
-1 siblings, 0 replies; 36+ messages in thread
From: Dan Carpenter @ 2021-01-05 11:52 UTC (permalink / raw)
To: jovin555
Cc: devel, Todd Kjos, Greg Kroah-Hartman, linux-kernel,
Arve Hjønnevåg, Joel Fernandes, Martijn Coenen,
Christian Brauner
On Mon, Dec 28, 2020 at 12:13:00AM -0500, jovin555 wrote:
> Warning found by checkpatch.pl script.
>
> Signed-off-by: jovin555 <jovin555@gmail.com>
Your Mama didn't name you "jovin555". You need to use your real name
like signing a legal document. Same for the "From:" header.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with const keyword
@ 2021-01-05 11:52 ` Dan Carpenter
0 siblings, 0 replies; 36+ messages in thread
From: Dan Carpenter @ 2021-01-05 11:52 UTC (permalink / raw)
To: jovin555
Cc: devel, Todd Kjos, Greg Kroah-Hartman, linux-kernel,
Arve Hjønnevåg, Joel Fernandes, Martijn Coenen,
Christian Brauner
On Mon, Dec 28, 2020 at 12:13:00AM -0500, jovin555 wrote:
> Warning found by checkpatch.pl script.
>
> Signed-off-by: jovin555 <jovin555@gmail.com>
Your Mama didn't name you "jovin555". You need to use your real name
like signing a legal document. Same for the "From:" header.
regards,
dan carpenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with const keyword
2022-01-24 7:09 ratnesh-r1
@ 2022-01-24 12:27 ` kernel test robot
2022-01-24 11:20 ` kernel test robot
2022-01-24 12:27 ` kernel test robot
2 siblings, 0 replies; 36+ messages in thread
From: kernel test robot @ 2022-01-24 12:27 UTC (permalink / raw)
To: ratnesh-r1
Cc: llvm, kbuild-all, me.ratnesh682, Greg Kroah-Hartman,
Arve Hjønnevåg, Todd Kjos, Martijn Coenen,
Joel Fernandes, Christian Brauner, devel, linux-kernel
Hi ratnesh-r1,
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/ratnesh-r1/staging-android-ashmem-Declared-file-operation-with-const-keyword/20220124-151116
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git fa783154524a71ab74e293cd8251155e5971952b
config: riscv-randconfig-c006-20220124 (https://download.01.org/0day-ci/archive/20220124/202201242027.9RTdyW5P-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2e58a18910867ba6795066e044293e6daf89edf5)
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 riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/c24fe2afe4abdf6436628abd13a0109ec420f373
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review ratnesh-r1/staging-android-ashmem-Declared-file-operation-with-const-keyword/20220124-151116
git checkout c24fe2afe4abdf6436628abd13a0109ec420f373
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/staging/android/
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:431: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:380:38: note: variable 'vmfile_fops' declared const here
static const struct file_operations vmfile_fops;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
drivers/staging/android/ashmem.c:432: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:380:38: note: variable 'vmfile_fops' declared const here
static const struct file_operations vmfile_fops;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
drivers/staging/android/ashmem.c:433: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:380:38: note: variable 'vmfile_fops' declared const here
static const struct file_operations vmfile_fops;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
3 errors generated.
vim +431 drivers/staging/android/ashmem.c
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 377
11980c2ac4ccfa Robert Love 2011-12-20 378 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
11980c2ac4ccfa Robert Love 2011-12-20 379 {
c24fe2afe4abdf ratnesh-r1 2022-01-23 380 static const struct file_operations vmfile_fops;
11980c2ac4ccfa Robert Love 2011-12-20 381 struct ashmem_area *asma = file->private_data;
11980c2ac4ccfa Robert Love 2011-12-20 382 int ret = 0;
11980c2ac4ccfa Robert Love 2011-12-20 383
11980c2ac4ccfa Robert Love 2011-12-20 384 mutex_lock(&ashmem_mutex);
11980c2ac4ccfa Robert Love 2011-12-20 385
11980c2ac4ccfa Robert Love 2011-12-20 386 /* user needs to SET_SIZE before mapping */
59848d6aded59a Alistair Strachan 2018-06-19 387 if (!asma->size) {
11980c2ac4ccfa Robert Love 2011-12-20 388 ret = -EINVAL;
11980c2ac4ccfa Robert Love 2011-12-20 389 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 390 }
11980c2ac4ccfa Robert Love 2011-12-20 391
8632c614565d0c Alistair Strachan 2018-06-19 392 /* requested mapping size larger than object size */
8632c614565d0c Alistair Strachan 2018-06-19 393 if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) {
11980c2ac4ccfa Robert Love 2011-12-20 394 ret = -EINVAL;
11980c2ac4ccfa Robert Love 2011-12-20 395 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 396 }
11980c2ac4ccfa Robert Love 2011-12-20 397
11980c2ac4ccfa Robert Love 2011-12-20 398 /* requested protection bits must match our allowed protection mask */
59848d6aded59a Alistair Strachan 2018-06-19 399 if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) &
59848d6aded59a Alistair Strachan 2018-06-19 400 calc_vm_prot_bits(PROT_MASK, 0)) {
11980c2ac4ccfa Robert Love 2011-12-20 401 ret = -EPERM;
11980c2ac4ccfa Robert Love 2011-12-20 402 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 403 }
56f76fc68492af Arve Hjønnevåg 2011-12-20 404 vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask);
11980c2ac4ccfa Robert Love 2011-12-20 405
11980c2ac4ccfa Robert Love 2011-12-20 406 if (!asma->file) {
11980c2ac4ccfa Robert Love 2011-12-20 407 char *name = ASHMEM_NAME_DEF;
11980c2ac4ccfa Robert Love 2011-12-20 408 struct file *vmfile;
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 409 struct inode *inode;
11980c2ac4ccfa Robert Love 2011-12-20 410
11980c2ac4ccfa Robert Love 2011-12-20 411 if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0')
11980c2ac4ccfa Robert Love 2011-12-20 412 name = asma->name;
11980c2ac4ccfa Robert Love 2011-12-20 413
11980c2ac4ccfa Robert Love 2011-12-20 414 /* ... and allocate the backing shmem file */
11980c2ac4ccfa Robert Love 2011-12-20 415 vmfile = shmem_file_setup(name, asma->size, vma->vm_flags);
7f44cb0ba88b40 Viresh Kumar 2015-07-31 416 if (IS_ERR(vmfile)) {
11980c2ac4ccfa Robert Love 2011-12-20 417 ret = PTR_ERR(vmfile);
11980c2ac4ccfa Robert Love 2011-12-20 418 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 419 }
97fbfef6bd5978 Shuxiao Zhang 2017-04-06 420 vmfile->f_mode |= FMODE_LSEEK;
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 421 inode = file_inode(vmfile);
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 422 lockdep_set_class(&inode->i_rwsem, &backing_shmem_inode_class);
11980c2ac4ccfa Robert Love 2011-12-20 423 asma->file = vmfile;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 424 /*
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 425 * override mmap operation of the vmfile so that it can't be
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 426 * remapped which would lead to creation of a new vma with no
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 427 * asma permission checks. Have to override get_unmapped_area
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 428 * as well to prevent VM_BUG_ON check for f_ops modification.
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 429 */
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 430 if (!vmfile_fops.mmap) {
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @431 vmfile_fops = *vmfile->f_op;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 432 vmfile_fops.mmap = ashmem_vmfile_mmap;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 433 vmfile_fops.get_unmapped_area =
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 434 ashmem_vmfile_get_unmapped_area;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 435 }
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 436 vmfile->f_op = &vmfile_fops;
11980c2ac4ccfa Robert Love 2011-12-20 437 }
11980c2ac4ccfa Robert Love 2011-12-20 438 get_file(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 439
11980c2ac4ccfa Robert Love 2011-12-20 440 /*
11980c2ac4ccfa Robert Love 2011-12-20 441 * XXX - Reworked to use shmem_zero_setup() instead of
11980c2ac4ccfa Robert Love 2011-12-20 442 * shmem_set_file while we're in staging. -jstultz
11980c2ac4ccfa Robert Love 2011-12-20 443 */
11980c2ac4ccfa Robert Love 2011-12-20 444 if (vma->vm_flags & VM_SHARED) {
11980c2ac4ccfa Robert Love 2011-12-20 445 ret = shmem_zero_setup(vma);
11980c2ac4ccfa Robert Love 2011-12-20 446 if (ret) {
11980c2ac4ccfa Robert Love 2011-12-20 447 fput(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 448 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 449 }
44960f2a7b63e2 John Stultz 2018-07-31 450 } else {
44960f2a7b63e2 John Stultz 2018-07-31 451 vma_set_anonymous(vma);
11980c2ac4ccfa Robert Love 2011-12-20 452 }
11980c2ac4ccfa Robert Love 2011-12-20 453
295992fb815e79 Christian König 2020-09-14 454 vma_set_file(vma, asma->file);
295992fb815e79 Christian König 2020-09-14 455 /* XXX: merge this with the get_file() above if possible */
295992fb815e79 Christian König 2020-09-14 456 fput(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 457
11980c2ac4ccfa Robert Love 2011-12-20 458 out:
11980c2ac4ccfa Robert Love 2011-12-20 459 mutex_unlock(&ashmem_mutex);
11980c2ac4ccfa Robert Love 2011-12-20 460 return ret;
11980c2ac4ccfa Robert Love 2011-12-20 461 }
11980c2ac4ccfa Robert Love 2011-12-20 462
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with const keyword
@ 2022-01-24 12:27 ` kernel test robot
0 siblings, 0 replies; 36+ messages in thread
From: kernel test robot @ 2022-01-24 12:27 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 9913 bytes --]
Hi ratnesh-r1,
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/ratnesh-r1/staging-android-ashmem-Declared-file-operation-with-const-keyword/20220124-151116
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git fa783154524a71ab74e293cd8251155e5971952b
config: riscv-randconfig-c006-20220124 (https://download.01.org/0day-ci/archive/20220124/202201242027.9RTdyW5P-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 2e58a18910867ba6795066e044293e6daf89edf5)
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 riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/c24fe2afe4abdf6436628abd13a0109ec420f373
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review ratnesh-r1/staging-android-ashmem-Declared-file-operation-with-const-keyword/20220124-151116
git checkout c24fe2afe4abdf6436628abd13a0109ec420f373
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/staging/android/
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:431: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:380:38: note: variable 'vmfile_fops' declared const here
static const struct file_operations vmfile_fops;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
drivers/staging/android/ashmem.c:432: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:380:38: note: variable 'vmfile_fops' declared const here
static const struct file_operations vmfile_fops;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
drivers/staging/android/ashmem.c:433: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:380:38: note: variable 'vmfile_fops' declared const here
static const struct file_operations vmfile_fops;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
3 errors generated.
vim +431 drivers/staging/android/ashmem.c
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 377
11980c2ac4ccfa Robert Love 2011-12-20 378 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
11980c2ac4ccfa Robert Love 2011-12-20 379 {
c24fe2afe4abdf ratnesh-r1 2022-01-23 380 static const struct file_operations vmfile_fops;
11980c2ac4ccfa Robert Love 2011-12-20 381 struct ashmem_area *asma = file->private_data;
11980c2ac4ccfa Robert Love 2011-12-20 382 int ret = 0;
11980c2ac4ccfa Robert Love 2011-12-20 383
11980c2ac4ccfa Robert Love 2011-12-20 384 mutex_lock(&ashmem_mutex);
11980c2ac4ccfa Robert Love 2011-12-20 385
11980c2ac4ccfa Robert Love 2011-12-20 386 /* user needs to SET_SIZE before mapping */
59848d6aded59a Alistair Strachan 2018-06-19 387 if (!asma->size) {
11980c2ac4ccfa Robert Love 2011-12-20 388 ret = -EINVAL;
11980c2ac4ccfa Robert Love 2011-12-20 389 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 390 }
11980c2ac4ccfa Robert Love 2011-12-20 391
8632c614565d0c Alistair Strachan 2018-06-19 392 /* requested mapping size larger than object size */
8632c614565d0c Alistair Strachan 2018-06-19 393 if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) {
11980c2ac4ccfa Robert Love 2011-12-20 394 ret = -EINVAL;
11980c2ac4ccfa Robert Love 2011-12-20 395 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 396 }
11980c2ac4ccfa Robert Love 2011-12-20 397
11980c2ac4ccfa Robert Love 2011-12-20 398 /* requested protection bits must match our allowed protection mask */
59848d6aded59a Alistair Strachan 2018-06-19 399 if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) &
59848d6aded59a Alistair Strachan 2018-06-19 400 calc_vm_prot_bits(PROT_MASK, 0)) {
11980c2ac4ccfa Robert Love 2011-12-20 401 ret = -EPERM;
11980c2ac4ccfa Robert Love 2011-12-20 402 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 403 }
56f76fc68492af Arve Hjønnevåg 2011-12-20 404 vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask);
11980c2ac4ccfa Robert Love 2011-12-20 405
11980c2ac4ccfa Robert Love 2011-12-20 406 if (!asma->file) {
11980c2ac4ccfa Robert Love 2011-12-20 407 char *name = ASHMEM_NAME_DEF;
11980c2ac4ccfa Robert Love 2011-12-20 408 struct file *vmfile;
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 409 struct inode *inode;
11980c2ac4ccfa Robert Love 2011-12-20 410
11980c2ac4ccfa Robert Love 2011-12-20 411 if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0')
11980c2ac4ccfa Robert Love 2011-12-20 412 name = asma->name;
11980c2ac4ccfa Robert Love 2011-12-20 413
11980c2ac4ccfa Robert Love 2011-12-20 414 /* ... and allocate the backing shmem file */
11980c2ac4ccfa Robert Love 2011-12-20 415 vmfile = shmem_file_setup(name, asma->size, vma->vm_flags);
7f44cb0ba88b40 Viresh Kumar 2015-07-31 416 if (IS_ERR(vmfile)) {
11980c2ac4ccfa Robert Love 2011-12-20 417 ret = PTR_ERR(vmfile);
11980c2ac4ccfa Robert Love 2011-12-20 418 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 419 }
97fbfef6bd5978 Shuxiao Zhang 2017-04-06 420 vmfile->f_mode |= FMODE_LSEEK;
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 421 inode = file_inode(vmfile);
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 422 lockdep_set_class(&inode->i_rwsem, &backing_shmem_inode_class);
11980c2ac4ccfa Robert Love 2011-12-20 423 asma->file = vmfile;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 424 /*
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 425 * override mmap operation of the vmfile so that it can't be
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 426 * remapped which would lead to creation of a new vma with no
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 427 * asma permission checks. Have to override get_unmapped_area
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 428 * as well to prevent VM_BUG_ON check for f_ops modification.
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 429 */
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 430 if (!vmfile_fops.mmap) {
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @431 vmfile_fops = *vmfile->f_op;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 432 vmfile_fops.mmap = ashmem_vmfile_mmap;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 433 vmfile_fops.get_unmapped_area =
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 434 ashmem_vmfile_get_unmapped_area;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 435 }
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 436 vmfile->f_op = &vmfile_fops;
11980c2ac4ccfa Robert Love 2011-12-20 437 }
11980c2ac4ccfa Robert Love 2011-12-20 438 get_file(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 439
11980c2ac4ccfa Robert Love 2011-12-20 440 /*
11980c2ac4ccfa Robert Love 2011-12-20 441 * XXX - Reworked to use shmem_zero_setup() instead of
11980c2ac4ccfa Robert Love 2011-12-20 442 * shmem_set_file while we're in staging. -jstultz
11980c2ac4ccfa Robert Love 2011-12-20 443 */
11980c2ac4ccfa Robert Love 2011-12-20 444 if (vma->vm_flags & VM_SHARED) {
11980c2ac4ccfa Robert Love 2011-12-20 445 ret = shmem_zero_setup(vma);
11980c2ac4ccfa Robert Love 2011-12-20 446 if (ret) {
11980c2ac4ccfa Robert Love 2011-12-20 447 fput(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 448 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 449 }
44960f2a7b63e2 John Stultz 2018-07-31 450 } else {
44960f2a7b63e2 John Stultz 2018-07-31 451 vma_set_anonymous(vma);
11980c2ac4ccfa Robert Love 2011-12-20 452 }
11980c2ac4ccfa Robert Love 2011-12-20 453
295992fb815e79 Christian König 2020-09-14 454 vma_set_file(vma, asma->file);
295992fb815e79 Christian König 2020-09-14 455 /* XXX: merge this with the get_file() above if possible */
295992fb815e79 Christian König 2020-09-14 456 fput(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 457
11980c2ac4ccfa Robert Love 2011-12-20 458 out:
11980c2ac4ccfa Robert Love 2011-12-20 459 mutex_unlock(&ashmem_mutex);
11980c2ac4ccfa Robert Love 2011-12-20 460 return ret;
11980c2ac4ccfa Robert Love 2011-12-20 461 }
11980c2ac4ccfa Robert Love 2011-12-20 462
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with const keyword
2022-01-24 7:09 ratnesh-r1
@ 2022-01-24 11:20 ` kernel test robot
2022-01-24 11:20 ` kernel test robot
2022-01-24 12:27 ` kernel test robot
2 siblings, 0 replies; 36+ messages in thread
From: kernel test robot @ 2022-01-24 11:20 UTC (permalink / raw)
To: ratnesh-r1
Cc: kbuild-all, me.ratnesh682, Greg Kroah-Hartman,
Arve Hjønnevåg, Todd Kjos, Martijn Coenen,
Joel Fernandes, Christian Brauner, devel, linux-kernel
Hi ratnesh-r1,
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/ratnesh-r1/staging-android-ashmem-Declared-file-operation-with-const-keyword/20220124-151116
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git fa783154524a71ab74e293cd8251155e5971952b
config: x86_64-randconfig-a002-20220124 (https://download.01.org/0day-ci/archive/20220124/202201241907.69JG769L-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/c24fe2afe4abdf6436628abd13a0109ec420f373
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review ratnesh-r1/staging-android-ashmem-Declared-file-operation-with-const-keyword/20220124-151116
git checkout c24fe2afe4abdf6436628abd13a0109ec420f373
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
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: In function 'ashmem_mmap':
>> drivers/staging/android/ashmem.c:431:16: error: assignment of read-only variable 'vmfile_fops'
431 | vmfile_fops = *vmfile->f_op;
| ^
>> drivers/staging/android/ashmem.c:432:21: error: assignment of member 'mmap' in read-only object
432 | vmfile_fops.mmap = ashmem_vmfile_mmap;
| ^
>> drivers/staging/android/ashmem.c:433:34: error: assignment of member 'get_unmapped_area' in read-only object
433 | vmfile_fops.get_unmapped_area =
| ^
vim +/vmfile_fops +431 drivers/staging/android/ashmem.c
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 377
11980c2ac4ccfa Robert Love 2011-12-20 378 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
11980c2ac4ccfa Robert Love 2011-12-20 379 {
c24fe2afe4abdf ratnesh-r1 2022-01-23 380 static const struct file_operations vmfile_fops;
11980c2ac4ccfa Robert Love 2011-12-20 381 struct ashmem_area *asma = file->private_data;
11980c2ac4ccfa Robert Love 2011-12-20 382 int ret = 0;
11980c2ac4ccfa Robert Love 2011-12-20 383
11980c2ac4ccfa Robert Love 2011-12-20 384 mutex_lock(&ashmem_mutex);
11980c2ac4ccfa Robert Love 2011-12-20 385
11980c2ac4ccfa Robert Love 2011-12-20 386 /* user needs to SET_SIZE before mapping */
59848d6aded59a Alistair Strachan 2018-06-19 387 if (!asma->size) {
11980c2ac4ccfa Robert Love 2011-12-20 388 ret = -EINVAL;
11980c2ac4ccfa Robert Love 2011-12-20 389 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 390 }
11980c2ac4ccfa Robert Love 2011-12-20 391
8632c614565d0c Alistair Strachan 2018-06-19 392 /* requested mapping size larger than object size */
8632c614565d0c Alistair Strachan 2018-06-19 393 if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) {
11980c2ac4ccfa Robert Love 2011-12-20 394 ret = -EINVAL;
11980c2ac4ccfa Robert Love 2011-12-20 395 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 396 }
11980c2ac4ccfa Robert Love 2011-12-20 397
11980c2ac4ccfa Robert Love 2011-12-20 398 /* requested protection bits must match our allowed protection mask */
59848d6aded59a Alistair Strachan 2018-06-19 399 if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) &
59848d6aded59a Alistair Strachan 2018-06-19 400 calc_vm_prot_bits(PROT_MASK, 0)) {
11980c2ac4ccfa Robert Love 2011-12-20 401 ret = -EPERM;
11980c2ac4ccfa Robert Love 2011-12-20 402 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 403 }
56f76fc68492af Arve Hjønnevåg 2011-12-20 404 vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask);
11980c2ac4ccfa Robert Love 2011-12-20 405
11980c2ac4ccfa Robert Love 2011-12-20 406 if (!asma->file) {
11980c2ac4ccfa Robert Love 2011-12-20 407 char *name = ASHMEM_NAME_DEF;
11980c2ac4ccfa Robert Love 2011-12-20 408 struct file *vmfile;
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 409 struct inode *inode;
11980c2ac4ccfa Robert Love 2011-12-20 410
11980c2ac4ccfa Robert Love 2011-12-20 411 if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0')
11980c2ac4ccfa Robert Love 2011-12-20 412 name = asma->name;
11980c2ac4ccfa Robert Love 2011-12-20 413
11980c2ac4ccfa Robert Love 2011-12-20 414 /* ... and allocate the backing shmem file */
11980c2ac4ccfa Robert Love 2011-12-20 415 vmfile = shmem_file_setup(name, asma->size, vma->vm_flags);
7f44cb0ba88b40 Viresh Kumar 2015-07-31 416 if (IS_ERR(vmfile)) {
11980c2ac4ccfa Robert Love 2011-12-20 417 ret = PTR_ERR(vmfile);
11980c2ac4ccfa Robert Love 2011-12-20 418 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 419 }
97fbfef6bd5978 Shuxiao Zhang 2017-04-06 420 vmfile->f_mode |= FMODE_LSEEK;
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 421 inode = file_inode(vmfile);
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 422 lockdep_set_class(&inode->i_rwsem, &backing_shmem_inode_class);
11980c2ac4ccfa Robert Love 2011-12-20 423 asma->file = vmfile;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 424 /*
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 425 * override mmap operation of the vmfile so that it can't be
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 426 * remapped which would lead to creation of a new vma with no
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 427 * asma permission checks. Have to override get_unmapped_area
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 428 * as well to prevent VM_BUG_ON check for f_ops modification.
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 429 */
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 430 if (!vmfile_fops.mmap) {
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @431 vmfile_fops = *vmfile->f_op;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @432 vmfile_fops.mmap = ashmem_vmfile_mmap;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @433 vmfile_fops.get_unmapped_area =
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 434 ashmem_vmfile_get_unmapped_area;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 435 }
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 436 vmfile->f_op = &vmfile_fops;
11980c2ac4ccfa Robert Love 2011-12-20 437 }
11980c2ac4ccfa Robert Love 2011-12-20 438 get_file(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 439
11980c2ac4ccfa Robert Love 2011-12-20 440 /*
11980c2ac4ccfa Robert Love 2011-12-20 441 * XXX - Reworked to use shmem_zero_setup() instead of
11980c2ac4ccfa Robert Love 2011-12-20 442 * shmem_set_file while we're in staging. -jstultz
11980c2ac4ccfa Robert Love 2011-12-20 443 */
11980c2ac4ccfa Robert Love 2011-12-20 444 if (vma->vm_flags & VM_SHARED) {
11980c2ac4ccfa Robert Love 2011-12-20 445 ret = shmem_zero_setup(vma);
11980c2ac4ccfa Robert Love 2011-12-20 446 if (ret) {
11980c2ac4ccfa Robert Love 2011-12-20 447 fput(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 448 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 449 }
44960f2a7b63e2 John Stultz 2018-07-31 450 } else {
44960f2a7b63e2 John Stultz 2018-07-31 451 vma_set_anonymous(vma);
11980c2ac4ccfa Robert Love 2011-12-20 452 }
11980c2ac4ccfa Robert Love 2011-12-20 453
295992fb815e79 Christian König 2020-09-14 454 vma_set_file(vma, asma->file);
295992fb815e79 Christian König 2020-09-14 455 /* XXX: merge this with the get_file() above if possible */
295992fb815e79 Christian König 2020-09-14 456 fput(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 457
11980c2ac4ccfa Robert Love 2011-12-20 458 out:
11980c2ac4ccfa Robert Love 2011-12-20 459 mutex_unlock(&ashmem_mutex);
11980c2ac4ccfa Robert Love 2011-12-20 460 return ret;
11980c2ac4ccfa Robert Love 2011-12-20 461 }
11980c2ac4ccfa Robert Love 2011-12-20 462
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with const keyword
@ 2022-01-24 11:20 ` kernel test robot
0 siblings, 0 replies; 36+ messages in thread
From: kernel test robot @ 2022-01-24 11:20 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 8704 bytes --]
Hi ratnesh-r1,
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/ratnesh-r1/staging-android-ashmem-Declared-file-operation-with-const-keyword/20220124-151116
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git fa783154524a71ab74e293cd8251155e5971952b
config: x86_64-randconfig-a002-20220124 (https://download.01.org/0day-ci/archive/20220124/202201241907.69JG769L-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/c24fe2afe4abdf6436628abd13a0109ec420f373
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review ratnesh-r1/staging-android-ashmem-Declared-file-operation-with-const-keyword/20220124-151116
git checkout c24fe2afe4abdf6436628abd13a0109ec420f373
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
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: In function 'ashmem_mmap':
>> drivers/staging/android/ashmem.c:431:16: error: assignment of read-only variable 'vmfile_fops'
431 | vmfile_fops = *vmfile->f_op;
| ^
>> drivers/staging/android/ashmem.c:432:21: error: assignment of member 'mmap' in read-only object
432 | vmfile_fops.mmap = ashmem_vmfile_mmap;
| ^
>> drivers/staging/android/ashmem.c:433:34: error: assignment of member 'get_unmapped_area' in read-only object
433 | vmfile_fops.get_unmapped_area =
| ^
vim +/vmfile_fops +431 drivers/staging/android/ashmem.c
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 377
11980c2ac4ccfa Robert Love 2011-12-20 378 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
11980c2ac4ccfa Robert Love 2011-12-20 379 {
c24fe2afe4abdf ratnesh-r1 2022-01-23 380 static const struct file_operations vmfile_fops;
11980c2ac4ccfa Robert Love 2011-12-20 381 struct ashmem_area *asma = file->private_data;
11980c2ac4ccfa Robert Love 2011-12-20 382 int ret = 0;
11980c2ac4ccfa Robert Love 2011-12-20 383
11980c2ac4ccfa Robert Love 2011-12-20 384 mutex_lock(&ashmem_mutex);
11980c2ac4ccfa Robert Love 2011-12-20 385
11980c2ac4ccfa Robert Love 2011-12-20 386 /* user needs to SET_SIZE before mapping */
59848d6aded59a Alistair Strachan 2018-06-19 387 if (!asma->size) {
11980c2ac4ccfa Robert Love 2011-12-20 388 ret = -EINVAL;
11980c2ac4ccfa Robert Love 2011-12-20 389 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 390 }
11980c2ac4ccfa Robert Love 2011-12-20 391
8632c614565d0c Alistair Strachan 2018-06-19 392 /* requested mapping size larger than object size */
8632c614565d0c Alistair Strachan 2018-06-19 393 if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) {
11980c2ac4ccfa Robert Love 2011-12-20 394 ret = -EINVAL;
11980c2ac4ccfa Robert Love 2011-12-20 395 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 396 }
11980c2ac4ccfa Robert Love 2011-12-20 397
11980c2ac4ccfa Robert Love 2011-12-20 398 /* requested protection bits must match our allowed protection mask */
59848d6aded59a Alistair Strachan 2018-06-19 399 if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) &
59848d6aded59a Alistair Strachan 2018-06-19 400 calc_vm_prot_bits(PROT_MASK, 0)) {
11980c2ac4ccfa Robert Love 2011-12-20 401 ret = -EPERM;
11980c2ac4ccfa Robert Love 2011-12-20 402 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 403 }
56f76fc68492af Arve Hjønnevåg 2011-12-20 404 vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask);
11980c2ac4ccfa Robert Love 2011-12-20 405
11980c2ac4ccfa Robert Love 2011-12-20 406 if (!asma->file) {
11980c2ac4ccfa Robert Love 2011-12-20 407 char *name = ASHMEM_NAME_DEF;
11980c2ac4ccfa Robert Love 2011-12-20 408 struct file *vmfile;
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 409 struct inode *inode;
11980c2ac4ccfa Robert Love 2011-12-20 410
11980c2ac4ccfa Robert Love 2011-12-20 411 if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0')
11980c2ac4ccfa Robert Love 2011-12-20 412 name = asma->name;
11980c2ac4ccfa Robert Love 2011-12-20 413
11980c2ac4ccfa Robert Love 2011-12-20 414 /* ... and allocate the backing shmem file */
11980c2ac4ccfa Robert Love 2011-12-20 415 vmfile = shmem_file_setup(name, asma->size, vma->vm_flags);
7f44cb0ba88b40 Viresh Kumar 2015-07-31 416 if (IS_ERR(vmfile)) {
11980c2ac4ccfa Robert Love 2011-12-20 417 ret = PTR_ERR(vmfile);
11980c2ac4ccfa Robert Love 2011-12-20 418 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 419 }
97fbfef6bd5978 Shuxiao Zhang 2017-04-06 420 vmfile->f_mode |= FMODE_LSEEK;
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 421 inode = file_inode(vmfile);
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 422 lockdep_set_class(&inode->i_rwsem, &backing_shmem_inode_class);
11980c2ac4ccfa Robert Love 2011-12-20 423 asma->file = vmfile;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 424 /*
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 425 * override mmap operation of the vmfile so that it can't be
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 426 * remapped which would lead to creation of a new vma with no
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 427 * asma permission checks. Have to override get_unmapped_area
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 428 * as well to prevent VM_BUG_ON check for f_ops modification.
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 429 */
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 430 if (!vmfile_fops.mmap) {
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @431 vmfile_fops = *vmfile->f_op;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @432 vmfile_fops.mmap = ashmem_vmfile_mmap;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @433 vmfile_fops.get_unmapped_area =
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 434 ashmem_vmfile_get_unmapped_area;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 435 }
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 436 vmfile->f_op = &vmfile_fops;
11980c2ac4ccfa Robert Love 2011-12-20 437 }
11980c2ac4ccfa Robert Love 2011-12-20 438 get_file(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 439
11980c2ac4ccfa Robert Love 2011-12-20 440 /*
11980c2ac4ccfa Robert Love 2011-12-20 441 * XXX - Reworked to use shmem_zero_setup() instead of
11980c2ac4ccfa Robert Love 2011-12-20 442 * shmem_set_file while we're in staging. -jstultz
11980c2ac4ccfa Robert Love 2011-12-20 443 */
11980c2ac4ccfa Robert Love 2011-12-20 444 if (vma->vm_flags & VM_SHARED) {
11980c2ac4ccfa Robert Love 2011-12-20 445 ret = shmem_zero_setup(vma);
11980c2ac4ccfa Robert Love 2011-12-20 446 if (ret) {
11980c2ac4ccfa Robert Love 2011-12-20 447 fput(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 448 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 449 }
44960f2a7b63e2 John Stultz 2018-07-31 450 } else {
44960f2a7b63e2 John Stultz 2018-07-31 451 vma_set_anonymous(vma);
11980c2ac4ccfa Robert Love 2011-12-20 452 }
11980c2ac4ccfa Robert Love 2011-12-20 453
295992fb815e79 Christian König 2020-09-14 454 vma_set_file(vma, asma->file);
295992fb815e79 Christian König 2020-09-14 455 /* XXX: merge this with the get_file() above if possible */
295992fb815e79 Christian König 2020-09-14 456 fput(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 457
11980c2ac4ccfa Robert Love 2011-12-20 458 out:
11980c2ac4ccfa Robert Love 2011-12-20 459 mutex_unlock(&ashmem_mutex);
11980c2ac4ccfa Robert Love 2011-12-20 460 return ret;
11980c2ac4ccfa Robert Love 2011-12-20 461 }
11980c2ac4ccfa Robert Love 2011-12-20 462
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with const keyword
2022-01-24 7:09 ratnesh-r1
@ 2022-01-24 7:39 ` Greg Kroah-Hartman
2022-01-24 11:20 ` kernel test robot
2022-01-24 12:27 ` kernel test robot
2 siblings, 0 replies; 36+ messages in thread
From: Greg Kroah-Hartman @ 2022-01-24 7:39 UTC (permalink / raw)
To: ratnesh-r1
Cc: devel, Todd Kjos, linux-kernel, Arve Hjønnevåg,
Joel Fernandes, Martijn Coenen, Christian Brauner
On Sun, Jan 23, 2022 at 11:09:47PM -0800, ratnesh-r1 wrote:
> warning found by checkpatch.pl script.
>
> Signed-off-by: ratnesh-r1 <me.ratnesh682@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 c05a214..f9cfa15 100644
> --- a/drivers/staging/android/ashmem.c
> +++ b/drivers/staging/android/ashmem.c
> @@ -367,7 +367,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.7.4
>
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- Your patch breaks the build.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH] staging: android: ashmem: Declared file operation with const keyword
@ 2022-01-24 7:09 ratnesh-r1
2022-01-24 7:39 ` Greg Kroah-Hartman
` (2 more replies)
0 siblings, 3 replies; 36+ messages in thread
From: ratnesh-r1 @ 2022-01-24 7:09 UTC (permalink / raw)
Cc: me.ratnesh682, Greg Kroah-Hartman, Arve Hjønnevåg,
Todd Kjos, Martijn Coenen, Joel Fernandes, Christian Brauner,
devel, linux-kernel
warning found by checkpatch.pl script.
Signed-off-by: ratnesh-r1 <me.ratnesh682@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 c05a214..f9cfa15 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -367,7 +367,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.7.4
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with 'const' keyword
2021-05-19 14:55 ` Greg Kroah-Hartman
@ 2021-05-19 15:56 ` Hriday Hegde
0 siblings, 0 replies; 36+ messages in thread
From: Hriday Hegde @ 2021-05-19 15:56 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Arve Hjønnevåg, Todd Kjos, Martijn Coenen,
Joel Fernandes, Christian Brauner, Hridya Valsaraju,
Suren Baghdasaryan, linux-kernel, linux-staging
On 19-05-2021 20:25, Greg Kroah-Hartman wrote:
> On Wed, May 19, 2021 at 08:06:14PM +0530, Hriday Hegde wrote:
>> On 19-05-2021 15:20, Greg Kroah-Hartman wrote:
>>> A: http://en.wikipedia.org/wiki/Top_post
>>> Q: Were do I find info about this thing called top-posting?
>>> A: Because it messes up the order in which people normally read text.
>>> Q: Why is top-posting such a bad thing?
>>> A: Top-posting.
>>> Q: What is the most annoying thing in e-mail?
>>>
>>> http://daringfireball.net/2007/07/on_top
>>>
>>> On Wed, May 19, 2021 at 03:00:08PM +0530, Hriday Hegde wrote:
>>>> I am not really sure how to do that and how to reflect it in the patch i followed what was taught in the Beginners course and it does not mention building. I know i need to test it out but is running 'patch -p1 < x.patch what i need to do?
>>> That does not build the code you changed, right?
>>>
>>> I'm sure whatever course you took, it did reference the fact that you
>>> need to ensure that your change actually works properly by the very
>>> least being able to be compiled correctly. Please go over those
>>> instructions again.
>>>
>>> good luck!
>>>
>>> greg k-h
>> I am using the A Beginner's Guide to Linux Kernel Development (LFD103) by the linux foundation for this but i cant find any commands to as to build and test , the only way i tried compiling is with a custom Makefile and it didn't work, i've got a few errors so the const keyword might not work here since the variable is being written to.
>>
>>
> That is correct, when compiling (i.e. building), the compiler shows that
> this is not a correct change.
>
> thanks,
>
> greg k-h
Oh ok will work with something else.
Thanks.
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with 'const' keyword
2021-05-19 14:51 ` Fabio Aiuto
@ 2021-05-19 15:54 ` Hriday Hegde
0 siblings, 0 replies; 36+ messages in thread
From: Hriday Hegde @ 2021-05-19 15:54 UTC (permalink / raw)
To: Fabio Aiuto
Cc: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
Martijn Coenen, Joel Fernandes, Christian Brauner,
Hridya Valsaraju, Suren Baghdasaryan, linux-kernel,
linux-staging
On 19-05-2021 20:21, Fabio Aiuto wrote:
> Hi Hriday,
>
> On Wed, May 19, 2021 at 08:06:14PM +0530, Hriday Hegde wrote:
>> On 19-05-2021 15:20, Greg Kroah-Hartman wrote:
>>> A: http://en.wikipedia.org/wiki/Top_post
>>> Q: Were do I find info about this thing called top-posting?
>>> A: Because it messes up the order in which people normally read text.
>>> Q: Why is top-posting such a bad thing?
>>> A: Top-posting.
>>> Q: What is the most annoying thing in e-mail?
>>>
>>> http://daringfireball.net/2007/07/on_top
>>>
>>> On Wed, May 19, 2021 at 03:00:08PM +0530, Hriday Hegde wrote:
>>>> I am not really sure how to do that and how to reflect it in the patch i followed what was taught in the Beginners course and it does not mention building. I know i need to test it out but is running 'patch -p1 < x.patch what i need to do?
>>> That does not build the code you changed, right?
>>>
>>> I'm sure whatever course you took, it did reference the fact that you
>>> need to ensure that your change actually works properly by the very
>>> least being able to be compiled correctly. Please go over those
>>> instructions again.
>>>
>>> good luck!
>>>
>>> greg k-h
>> I am using the A Beginner's Guide to Linux Kernel Development (LFD103) by the linux foundation for this but i cant find any commands to as to build and test , the only way i tried compiling is with a custom Makefile and it didn't work, i've got a few errors so the const keyword might not work here since the variable is being written to.
>>
>>
> try following this tutorial from scratch:
>
> https://kernelnewbies.org/FirstKernelPatch
>
> it's simply complete and helps a lot, from
> gathering all tools needed to contribute to the
> community to sending whole patchsets.
>
> In your emails don't go over 80-100 character per line,
> when you ask things or your mails will be difficult
> to read.
>
> thank you,
>
> fabio
Thank you for the guidance, and will keep the char limit in
mind.
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with 'const' keyword
2021-05-19 14:36 ` Hriday Hegde
2021-05-19 14:51 ` Fabio Aiuto
@ 2021-05-19 14:55 ` Greg Kroah-Hartman
2021-05-19 15:56 ` Hriday Hegde
1 sibling, 1 reply; 36+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-19 14:55 UTC (permalink / raw)
To: Hriday Hegde
Cc: Arve Hjønnevåg, Todd Kjos, Martijn Coenen,
Joel Fernandes, Christian Brauner, Hridya Valsaraju,
Suren Baghdasaryan, linux-kernel, linux-staging
On Wed, May 19, 2021 at 08:06:14PM +0530, Hriday Hegde wrote:
> On 19-05-2021 15:20, Greg Kroah-Hartman wrote:
> > A: http://en.wikipedia.org/wiki/Top_post
> > Q: Were do I find info about this thing called top-posting?
> > A: Because it messes up the order in which people normally read text.
> > Q: Why is top-posting such a bad thing?
> > A: Top-posting.
> > Q: What is the most annoying thing in e-mail?
> >
> > http://daringfireball.net/2007/07/on_top
> >
> > On Wed, May 19, 2021 at 03:00:08PM +0530, Hriday Hegde wrote:
> >> I am not really sure how to do that and how to reflect it in the patch i followed what was taught in the Beginners course and it does not mention building. I know i need to test it out but is running 'patch -p1 < x.patch what i need to do?
> > That does not build the code you changed, right?
> >
> > I'm sure whatever course you took, it did reference the fact that you
> > need to ensure that your change actually works properly by the very
> > least being able to be compiled correctly. Please go over those
> > instructions again.
> >
> > good luck!
> >
> > greg k-h
>
> I am using the A Beginner's Guide to Linux Kernel Development (LFD103) by the linux foundation for this but i cant find any commands to as to build and test , the only way i tried compiling is with a custom Makefile and it didn't work, i've got a few errors so the const keyword might not work here since the variable is being written to.
>
>
That is correct, when compiling (i.e. building), the compiler shows that
this is not a correct change.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with 'const' keyword
2021-05-19 14:36 ` Hriday Hegde
@ 2021-05-19 14:51 ` Fabio Aiuto
2021-05-19 15:54 ` Hriday Hegde
2021-05-19 14:55 ` Greg Kroah-Hartman
1 sibling, 1 reply; 36+ messages in thread
From: Fabio Aiuto @ 2021-05-19 14:51 UTC (permalink / raw)
To: Hriday Hegde
Cc: Greg Kroah-Hartman, Arve Hjønnevåg, Todd Kjos,
Martijn Coenen, Joel Fernandes, Christian Brauner,
Hridya Valsaraju, Suren Baghdasaryan, linux-kernel,
linux-staging
Hi Hriday,
On Wed, May 19, 2021 at 08:06:14PM +0530, Hriday Hegde wrote:
> On 19-05-2021 15:20, Greg Kroah-Hartman wrote:
> > A: http://en.wikipedia.org/wiki/Top_post
> > Q: Were do I find info about this thing called top-posting?
> > A: Because it messes up the order in which people normally read text.
> > Q: Why is top-posting such a bad thing?
> > A: Top-posting.
> > Q: What is the most annoying thing in e-mail?
> >
> > http://daringfireball.net/2007/07/on_top
> >
> > On Wed, May 19, 2021 at 03:00:08PM +0530, Hriday Hegde wrote:
> >> I am not really sure how to do that and how to reflect it in the patch i followed what was taught in the Beginners course and it does not mention building. I know i need to test it out but is running 'patch -p1 < x.patch what i need to do?
> > That does not build the code you changed, right?
> >
> > I'm sure whatever course you took, it did reference the fact that you
> > need to ensure that your change actually works properly by the very
> > least being able to be compiled correctly. Please go over those
> > instructions again.
> >
> > good luck!
> >
> > greg k-h
>
> I am using the A Beginner's Guide to Linux Kernel Development (LFD103) by the linux foundation for this but i cant find any commands to as to build and test , the only way i tried compiling is with a custom Makefile and it didn't work, i've got a few errors so the const keyword might not work here since the variable is being written to.
>
>
try following this tutorial from scratch:
https://kernelnewbies.org/FirstKernelPatch
it's simply complete and helps a lot, from
gathering all tools needed to contribute to the
community to sending whole patchsets.
In your emails don't go over 80-100 character per line,
when you ask things or your mails will be difficult
to read.
thank you,
fabio
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with 'const' keyword
2021-05-19 9:50 ` Greg Kroah-Hartman
@ 2021-05-19 14:36 ` Hriday Hegde
2021-05-19 14:51 ` Fabio Aiuto
2021-05-19 14:55 ` Greg Kroah-Hartman
0 siblings, 2 replies; 36+ messages in thread
From: Hriday Hegde @ 2021-05-19 14:36 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Arve Hjønnevåg, Todd Kjos, Martijn Coenen,
Joel Fernandes, Christian Brauner, Hridya Valsaraju,
Suren Baghdasaryan, linux-kernel, linux-staging
On 19-05-2021 15:20, Greg Kroah-Hartman wrote:
> A: http://en.wikipedia.org/wiki/Top_post
> Q: Were do I find info about this thing called top-posting?
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
> A: Top-posting.
> Q: What is the most annoying thing in e-mail?
>
> http://daringfireball.net/2007/07/on_top
>
> On Wed, May 19, 2021 at 03:00:08PM +0530, Hriday Hegde wrote:
>> I am not really sure how to do that and how to reflect it in the patch i followed what was taught in the Beginners course and it does not mention building. I know i need to test it out but is running 'patch -p1 < x.patch what i need to do?
> That does not build the code you changed, right?
>
> I'm sure whatever course you took, it did reference the fact that you
> need to ensure that your change actually works properly by the very
> least being able to be compiled correctly. Please go over those
> instructions again.
>
> good luck!
>
> greg k-h
I am using the A Beginner's Guide to Linux Kernel Development (LFD103) by the linux foundation for this but i cant find any commands to as to build and test , the only way i tried compiling is with a custom Makefile and it didn't work, i've got a few errors so the const keyword might not work here since the variable is being written to.
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with 'const' keyword
2021-05-19 9:30 ` Hriday Hegde
@ 2021-05-19 9:50 ` Greg Kroah-Hartman
2021-05-19 14:36 ` Hriday Hegde
0 siblings, 1 reply; 36+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-19 9:50 UTC (permalink / raw)
To: Hriday Hegde
Cc: Arve Hjønnevåg, Todd Kjos, Martijn Coenen,
Joel Fernandes, Christian Brauner, Hridya Valsaraju,
Suren Baghdasaryan, linux-kernel, linux-staging
A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
http://daringfireball.net/2007/07/on_top
On Wed, May 19, 2021 at 03:00:08PM +0530, Hriday Hegde wrote:
> I am not really sure how to do that and how to reflect it in the patch i followed what was taught in the Beginners course and it does not mention building. I know i need to test it out but is running 'patch -p1 < x.patch what i need to do?
That does not build the code you changed, right?
I'm sure whatever course you took, it did reference the fact that you
need to ensure that your change actually works properly by the very
least being able to be compiled correctly. Please go over those
instructions again.
good luck!
greg k-h
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with 'const' keyword
2021-05-19 8:31 ` Greg Kroah-Hartman
@ 2021-05-19 9:30 ` Hriday Hegde
2021-05-19 9:50 ` Greg Kroah-Hartman
0 siblings, 1 reply; 36+ messages in thread
From: Hriday Hegde @ 2021-05-19 9:30 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Arve Hjønnevåg, Todd Kjos, Martijn Coenen,
Joel Fernandes, Christian Brauner, Hridya Valsaraju,
Suren Baghdasaryan, linux-kernel, linux-staging
I am not really sure how to do that and how to reflect it in the patch i followed what was taught in the Beginners course and it does not mention building. I know i need to test it out but is running 'patch -p1 < x.patch what i need to do?
On 19-05-2021 14:01, Greg Kroah-Hartman wrote:
> On Wed, May 19, 2021 at 01:19:58AM -0700, Hriday Hegde wrote:
>> Fixing following warnings found by checkpatch.pl
>> WARNING: struct file_operations should normally be const
>> 380: FILE: drivers/staging/android/ashmem.c:380:
>> + static struct file_operations vmfile_fops;
>>
>> Signed-off-by: Hriday Hegde <hridayhegde1999@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 8ee4320a5dc6..8ff2794b08e3 100644
>> --- a/drivers/staging/android/ashmem.c
>> +++ b/drivers/staging/android/ashmem.c
>> @@ -377,7 +377,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.25.1
>>
>>
> Any reason why you didn't build your change before submitting this
> patch?
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with 'const' keyword
2021-05-19 8:19 ` Hriday Hegde
(?)
@ 2021-05-19 8:31 ` Greg Kroah-Hartman
2021-05-19 9:30 ` Hriday Hegde
-1 siblings, 1 reply; 36+ messages in thread
From: Greg Kroah-Hartman @ 2021-05-19 8:31 UTC (permalink / raw)
To: Hriday Hegde
Cc: Arve Hjønnevåg, Todd Kjos, Martijn Coenen,
Joel Fernandes, Christian Brauner, Hridya Valsaraju,
Suren Baghdasaryan, linux-kernel, linux-staging
On Wed, May 19, 2021 at 01:19:58AM -0700, Hriday Hegde wrote:
> Fixing following warnings found by checkpatch.pl
> WARNING: struct file_operations should normally be const
> 380: FILE: drivers/staging/android/ashmem.c:380:
> + static struct file_operations vmfile_fops;
>
> Signed-off-by: Hriday Hegde <hridayhegde1999@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 8ee4320a5dc6..8ff2794b08e3 100644
> --- a/drivers/staging/android/ashmem.c
> +++ b/drivers/staging/android/ashmem.c
> @@ -377,7 +377,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.25.1
>
>
Any reason why you didn't build your change before submitting this
patch?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH] staging: android: ashmem: Declared file operation with 'const' keyword
@ 2021-05-19 8:19 ` Hriday Hegde
0 siblings, 0 replies; 36+ messages in thread
From: Hriday Hegde @ 2021-05-19 8:19 UTC (permalink / raw)
Cc: hridayhegde1999, Greg Kroah-Hartman, Arve Hjønnevåg,
Todd Kjos, Martijn Coenen, Joel Fernandes, Christian Brauner,
Hridya Valsaraju, Suren Baghdasaryan, linux-kernel,
linux-staging
Fixing following warnings found by checkpatch.pl
WARNING: struct file_operations should normally be const
380: FILE: drivers/staging/android/ashmem.c:380:
+ static struct file_operations vmfile_fops;
Signed-off-by: Hriday Hegde <hridayhegde1999@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 8ee4320a5dc6..8ff2794b08e3 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -377,7 +377,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.25.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH] staging: android: ashmem: Declared file operation with 'const' keyword
@ 2021-05-19 8:19 ` Hriday Hegde
0 siblings, 0 replies; 36+ messages in thread
From: Hriday Hegde @ 2021-05-19 8:19 UTC (permalink / raw)
Cc: hridayhegde1999, Greg Kroah-Hartman, Arve Hjønnevåg,
Todd Kjos, Martijn Coenen, Joel Fernandes, Christian Brauner,
Hridya Valsaraju, Suren Baghdasaryan, linux-kernel,
linux-staging
Fixing following warnings found by checkpatch.pl
WARNING: struct file_operations should normally be const
380: FILE: drivers/staging/android/ashmem.c:380:
+ static struct file_operations vmfile_fops;
Signed-off-by: Hriday Hegde <hridayhegde1999@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 8ee4320a5dc6..8ff2794b08e3 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -377,7 +377,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.25.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with const keyword
2021-02-14 2:31 ` Thais Camacho
@ 2021-02-14 8:21 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 36+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-14 8:21 UTC (permalink / raw)
To: Thais Camacho
Cc: devel, Todd Kjos, linux-kernel, Hridya Valsaraju,
Arve Hjønnevåg, Joel Fernandes, Martijn Coenen,
Suren Baghdasaryan, Christian Brauner
On Sat, Feb 13, 2021 at 11:31:36PM -0300, Thais Camacho wrote:
> Warning found by checkpatch.pl script
>
> Signed-off-by: Thais Camacho <thaiscamachoo@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.20.1
Any specific reason why you did not test-build your change before
sending it to us? Please always do so, otherwise it causes lots of
problems, and makes maintainers grumpy :)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with const keyword
@ 2021-02-14 8:21 ` Greg Kroah-Hartman
0 siblings, 0 replies; 36+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-14 8:21 UTC (permalink / raw)
To: Thais Camacho
Cc: devel, Todd Kjos, Suren Baghdasaryan, linux-kernel,
Joel Fernandes, Arve Hjønnevåg, Hridya Valsaraju,
Martijn Coenen, Christian Brauner
On Sat, Feb 13, 2021 at 11:31:36PM -0300, Thais Camacho wrote:
> Warning found by checkpatch.pl script
>
> Signed-off-by: Thais Camacho <thaiscamachoo@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.20.1
Any specific reason why you did not test-build your change before
sending it to us? Please always do so, otherwise it causes lots of
problems, and makes maintainers grumpy :)
thanks,
greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with const keyword
2021-02-14 2:31 ` Thais Camacho
(?)
@ 2021-02-14 4:49 ` kernel test robot
-1 siblings, 0 replies; 36+ messages in thread
From: kernel test robot @ 2021-02-14 4:49 UTC (permalink / raw)
To: Thais Camacho
Cc: kbuild-all, devel, Todd Kjos, Greg Kroah-Hartman, linux-kernel,
thaiscamachoo, Hridya Valsaraju, Arve Hjønnevåg,
Joel Fernandes, Martijn Coenen, Suren Baghdasaryan
[-- Attachment #1: Type: text/plain, Size: 9621 bytes --]
Hi Thais,
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/Thais-Camacho/staging-android-ashmem-Declared-file-operation-with-const-keyword/20210214-103440
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 4eb839aef182fccf8995ee439fc2b48d43e45918
config: x86_64-randconfig-a014-20210214 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project c9439ca36342fb6013187d0a69aef92736951476)
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/32b5e3c9154f059b60686c16a3c3a316f85b6976
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Thais-Camacho/staging-android-ashmem-Declared-file-operation-with-const-keyword/20210214-103440
git checkout 32b5e3c9154f059b60686c16a3c3a316f85b6976
# 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@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
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 376
11980c2ac4ccfa Robert Love 2011-12-20 377 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
11980c2ac4ccfa Robert Love 2011-12-20 378 {
32b5e3c9154f05 Thais Camacho 2021-02-13 379 static const struct file_operations vmfile_fops;
11980c2ac4ccfa Robert Love 2011-12-20 380 struct ashmem_area *asma = file->private_data;
11980c2ac4ccfa Robert Love 2011-12-20 381 int ret = 0;
11980c2ac4ccfa Robert Love 2011-12-20 382
11980c2ac4ccfa Robert Love 2011-12-20 383 mutex_lock(&ashmem_mutex);
11980c2ac4ccfa Robert Love 2011-12-20 384
11980c2ac4ccfa Robert Love 2011-12-20 385 /* user needs to SET_SIZE before mapping */
59848d6aded59a Alistair Strachan 2018-06-19 386 if (!asma->size) {
11980c2ac4ccfa Robert Love 2011-12-20 387 ret = -EINVAL;
11980c2ac4ccfa Robert Love 2011-12-20 388 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 389 }
11980c2ac4ccfa Robert Love 2011-12-20 390
8632c614565d0c Alistair Strachan 2018-06-19 391 /* requested mapping size larger than object size */
8632c614565d0c Alistair Strachan 2018-06-19 392 if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) {
11980c2ac4ccfa Robert Love 2011-12-20 393 ret = -EINVAL;
11980c2ac4ccfa Robert Love 2011-12-20 394 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 395 }
11980c2ac4ccfa Robert Love 2011-12-20 396
11980c2ac4ccfa Robert Love 2011-12-20 397 /* requested protection bits must match our allowed protection mask */
59848d6aded59a Alistair Strachan 2018-06-19 398 if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) &
59848d6aded59a Alistair Strachan 2018-06-19 399 calc_vm_prot_bits(PROT_MASK, 0)) {
11980c2ac4ccfa Robert Love 2011-12-20 400 ret = -EPERM;
11980c2ac4ccfa Robert Love 2011-12-20 401 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 402 }
56f76fc68492af Arve Hjønnevåg 2011-12-20 403 vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask);
11980c2ac4ccfa Robert Love 2011-12-20 404
11980c2ac4ccfa Robert Love 2011-12-20 405 if (!asma->file) {
11980c2ac4ccfa Robert Love 2011-12-20 406 char *name = ASHMEM_NAME_DEF;
11980c2ac4ccfa Robert Love 2011-12-20 407 struct file *vmfile;
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 408 struct inode *inode;
11980c2ac4ccfa Robert Love 2011-12-20 409
11980c2ac4ccfa Robert Love 2011-12-20 410 if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0')
11980c2ac4ccfa Robert Love 2011-12-20 411 name = asma->name;
11980c2ac4ccfa Robert Love 2011-12-20 412
11980c2ac4ccfa Robert Love 2011-12-20 413 /* ... and allocate the backing shmem file */
11980c2ac4ccfa Robert Love 2011-12-20 414 vmfile = shmem_file_setup(name, asma->size, vma->vm_flags);
7f44cb0ba88b40 Viresh Kumar 2015-07-31 415 if (IS_ERR(vmfile)) {
11980c2ac4ccfa Robert Love 2011-12-20 416 ret = PTR_ERR(vmfile);
11980c2ac4ccfa Robert Love 2011-12-20 417 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 418 }
97fbfef6bd5978 Shuxiao Zhang 2017-04-06 419 vmfile->f_mode |= FMODE_LSEEK;
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 420 inode = file_inode(vmfile);
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 421 lockdep_set_class(&inode->i_rwsem, &backing_shmem_inode_class);
11980c2ac4ccfa Robert Love 2011-12-20 422 asma->file = vmfile;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 423 /*
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 424 * override mmap operation of the vmfile so that it can't be
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 425 * remapped which would lead to creation of a new vma with no
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 426 * asma permission checks. Have to override get_unmapped_area
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 427 * as well to prevent VM_BUG_ON check for f_ops modification.
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 428 */
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 429 if (!vmfile_fops.mmap) {
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @430 vmfile_fops = *vmfile->f_op;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 431 vmfile_fops.mmap = ashmem_vmfile_mmap;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 432 vmfile_fops.get_unmapped_area =
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 433 ashmem_vmfile_get_unmapped_area;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 434 }
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 435 vmfile->f_op = &vmfile_fops;
11980c2ac4ccfa Robert Love 2011-12-20 436 }
11980c2ac4ccfa Robert Love 2011-12-20 437 get_file(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 438
11980c2ac4ccfa Robert Love 2011-12-20 439 /*
11980c2ac4ccfa Robert Love 2011-12-20 440 * XXX - Reworked to use shmem_zero_setup() instead of
11980c2ac4ccfa Robert Love 2011-12-20 441 * shmem_set_file while we're in staging. -jstultz
11980c2ac4ccfa Robert Love 2011-12-20 442 */
11980c2ac4ccfa Robert Love 2011-12-20 443 if (vma->vm_flags & VM_SHARED) {
11980c2ac4ccfa Robert Love 2011-12-20 444 ret = shmem_zero_setup(vma);
11980c2ac4ccfa Robert Love 2011-12-20 445 if (ret) {
11980c2ac4ccfa Robert Love 2011-12-20 446 fput(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 447 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 448 }
44960f2a7b63e2 John Stultz 2018-07-31 449 } else {
44960f2a7b63e2 John Stultz 2018-07-31 450 vma_set_anonymous(vma);
11980c2ac4ccfa Robert Love 2011-12-20 451 }
11980c2ac4ccfa Robert Love 2011-12-20 452
295992fb815e79 Christian König 2020-09-14 453 vma_set_file(vma, asma->file);
295992fb815e79 Christian König 2020-09-14 454 /* XXX: merge this with the get_file() above if possible */
295992fb815e79 Christian König 2020-09-14 455 fput(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 456
11980c2ac4ccfa Robert Love 2011-12-20 457 out:
11980c2ac4ccfa Robert Love 2011-12-20 458 mutex_unlock(&ashmem_mutex);
11980c2ac4ccfa Robert Love 2011-12-20 459 return ret;
11980c2ac4ccfa Robert Love 2011-12-20 460 }
11980c2ac4ccfa 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: 29152 bytes --]
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with const keyword
@ 2021-02-14 4:49 ` kernel test robot
0 siblings, 0 replies; 36+ messages in thread
From: kernel test robot @ 2021-02-14 4:49 UTC (permalink / raw)
To: Thais Camacho
Cc: devel, Todd Kjos, Greg Kroah-Hartman, linux-kernel,
thaiscamachoo, Joel Fernandes, Arve Hjønnevåg,
Hridya Valsaraju, kbuild-all, Martijn Coenen, Suren Baghdasaryan
[-- Attachment #1: Type: text/plain, Size: 9621 bytes --]
Hi Thais,
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/Thais-Camacho/staging-android-ashmem-Declared-file-operation-with-const-keyword/20210214-103440
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 4eb839aef182fccf8995ee439fc2b48d43e45918
config: x86_64-randconfig-a014-20210214 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project c9439ca36342fb6013187d0a69aef92736951476)
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/32b5e3c9154f059b60686c16a3c3a316f85b6976
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Thais-Camacho/staging-android-ashmem-Declared-file-operation-with-const-keyword/20210214-103440
git checkout 32b5e3c9154f059b60686c16a3c3a316f85b6976
# 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@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
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 376
11980c2ac4ccfa Robert Love 2011-12-20 377 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
11980c2ac4ccfa Robert Love 2011-12-20 378 {
32b5e3c9154f05 Thais Camacho 2021-02-13 379 static const struct file_operations vmfile_fops;
11980c2ac4ccfa Robert Love 2011-12-20 380 struct ashmem_area *asma = file->private_data;
11980c2ac4ccfa Robert Love 2011-12-20 381 int ret = 0;
11980c2ac4ccfa Robert Love 2011-12-20 382
11980c2ac4ccfa Robert Love 2011-12-20 383 mutex_lock(&ashmem_mutex);
11980c2ac4ccfa Robert Love 2011-12-20 384
11980c2ac4ccfa Robert Love 2011-12-20 385 /* user needs to SET_SIZE before mapping */
59848d6aded59a Alistair Strachan 2018-06-19 386 if (!asma->size) {
11980c2ac4ccfa Robert Love 2011-12-20 387 ret = -EINVAL;
11980c2ac4ccfa Robert Love 2011-12-20 388 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 389 }
11980c2ac4ccfa Robert Love 2011-12-20 390
8632c614565d0c Alistair Strachan 2018-06-19 391 /* requested mapping size larger than object size */
8632c614565d0c Alistair Strachan 2018-06-19 392 if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) {
11980c2ac4ccfa Robert Love 2011-12-20 393 ret = -EINVAL;
11980c2ac4ccfa Robert Love 2011-12-20 394 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 395 }
11980c2ac4ccfa Robert Love 2011-12-20 396
11980c2ac4ccfa Robert Love 2011-12-20 397 /* requested protection bits must match our allowed protection mask */
59848d6aded59a Alistair Strachan 2018-06-19 398 if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) &
59848d6aded59a Alistair Strachan 2018-06-19 399 calc_vm_prot_bits(PROT_MASK, 0)) {
11980c2ac4ccfa Robert Love 2011-12-20 400 ret = -EPERM;
11980c2ac4ccfa Robert Love 2011-12-20 401 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 402 }
56f76fc68492af Arve Hjønnevåg 2011-12-20 403 vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask);
11980c2ac4ccfa Robert Love 2011-12-20 404
11980c2ac4ccfa Robert Love 2011-12-20 405 if (!asma->file) {
11980c2ac4ccfa Robert Love 2011-12-20 406 char *name = ASHMEM_NAME_DEF;
11980c2ac4ccfa Robert Love 2011-12-20 407 struct file *vmfile;
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 408 struct inode *inode;
11980c2ac4ccfa Robert Love 2011-12-20 409
11980c2ac4ccfa Robert Love 2011-12-20 410 if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0')
11980c2ac4ccfa Robert Love 2011-12-20 411 name = asma->name;
11980c2ac4ccfa Robert Love 2011-12-20 412
11980c2ac4ccfa Robert Love 2011-12-20 413 /* ... and allocate the backing shmem file */
11980c2ac4ccfa Robert Love 2011-12-20 414 vmfile = shmem_file_setup(name, asma->size, vma->vm_flags);
7f44cb0ba88b40 Viresh Kumar 2015-07-31 415 if (IS_ERR(vmfile)) {
11980c2ac4ccfa Robert Love 2011-12-20 416 ret = PTR_ERR(vmfile);
11980c2ac4ccfa Robert Love 2011-12-20 417 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 418 }
97fbfef6bd5978 Shuxiao Zhang 2017-04-06 419 vmfile->f_mode |= FMODE_LSEEK;
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 420 inode = file_inode(vmfile);
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 421 lockdep_set_class(&inode->i_rwsem, &backing_shmem_inode_class);
11980c2ac4ccfa Robert Love 2011-12-20 422 asma->file = vmfile;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 423 /*
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 424 * override mmap operation of the vmfile so that it can't be
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 425 * remapped which would lead to creation of a new vma with no
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 426 * asma permission checks. Have to override get_unmapped_area
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 427 * as well to prevent VM_BUG_ON check for f_ops modification.
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 428 */
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 429 if (!vmfile_fops.mmap) {
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @430 vmfile_fops = *vmfile->f_op;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 431 vmfile_fops.mmap = ashmem_vmfile_mmap;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 432 vmfile_fops.get_unmapped_area =
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 433 ashmem_vmfile_get_unmapped_area;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 434 }
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 435 vmfile->f_op = &vmfile_fops;
11980c2ac4ccfa Robert Love 2011-12-20 436 }
11980c2ac4ccfa Robert Love 2011-12-20 437 get_file(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 438
11980c2ac4ccfa Robert Love 2011-12-20 439 /*
11980c2ac4ccfa Robert Love 2011-12-20 440 * XXX - Reworked to use shmem_zero_setup() instead of
11980c2ac4ccfa Robert Love 2011-12-20 441 * shmem_set_file while we're in staging. -jstultz
11980c2ac4ccfa Robert Love 2011-12-20 442 */
11980c2ac4ccfa Robert Love 2011-12-20 443 if (vma->vm_flags & VM_SHARED) {
11980c2ac4ccfa Robert Love 2011-12-20 444 ret = shmem_zero_setup(vma);
11980c2ac4ccfa Robert Love 2011-12-20 445 if (ret) {
11980c2ac4ccfa Robert Love 2011-12-20 446 fput(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 447 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 448 }
44960f2a7b63e2 John Stultz 2018-07-31 449 } else {
44960f2a7b63e2 John Stultz 2018-07-31 450 vma_set_anonymous(vma);
11980c2ac4ccfa Robert Love 2011-12-20 451 }
11980c2ac4ccfa Robert Love 2011-12-20 452
295992fb815e79 Christian König 2020-09-14 453 vma_set_file(vma, asma->file);
295992fb815e79 Christian König 2020-09-14 454 /* XXX: merge this with the get_file() above if possible */
295992fb815e79 Christian König 2020-09-14 455 fput(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 456
11980c2ac4ccfa Robert Love 2011-12-20 457 out:
11980c2ac4ccfa Robert Love 2011-12-20 458 mutex_unlock(&ashmem_mutex);
11980c2ac4ccfa Robert Love 2011-12-20 459 return ret;
11980c2ac4ccfa Robert Love 2011-12-20 460 }
11980c2ac4ccfa 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: 29152 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] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with const keyword
@ 2021-02-14 4:49 ` kernel test robot
0 siblings, 0 replies; 36+ messages in thread
From: kernel test robot @ 2021-02-14 4:49 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 9768 bytes --]
Hi Thais,
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/Thais-Camacho/staging-android-ashmem-Declared-file-operation-with-const-keyword/20210214-103440
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 4eb839aef182fccf8995ee439fc2b48d43e45918
config: x86_64-randconfig-a014-20210214 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project c9439ca36342fb6013187d0a69aef92736951476)
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/32b5e3c9154f059b60686c16a3c3a316f85b6976
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Thais-Camacho/staging-android-ashmem-Declared-file-operation-with-const-keyword/20210214-103440
git checkout 32b5e3c9154f059b60686c16a3c3a316f85b6976
# 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@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
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 376
11980c2ac4ccfa Robert Love 2011-12-20 377 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
11980c2ac4ccfa Robert Love 2011-12-20 378 {
32b5e3c9154f05 Thais Camacho 2021-02-13 379 static const struct file_operations vmfile_fops;
11980c2ac4ccfa Robert Love 2011-12-20 380 struct ashmem_area *asma = file->private_data;
11980c2ac4ccfa Robert Love 2011-12-20 381 int ret = 0;
11980c2ac4ccfa Robert Love 2011-12-20 382
11980c2ac4ccfa Robert Love 2011-12-20 383 mutex_lock(&ashmem_mutex);
11980c2ac4ccfa Robert Love 2011-12-20 384
11980c2ac4ccfa Robert Love 2011-12-20 385 /* user needs to SET_SIZE before mapping */
59848d6aded59a Alistair Strachan 2018-06-19 386 if (!asma->size) {
11980c2ac4ccfa Robert Love 2011-12-20 387 ret = -EINVAL;
11980c2ac4ccfa Robert Love 2011-12-20 388 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 389 }
11980c2ac4ccfa Robert Love 2011-12-20 390
8632c614565d0c Alistair Strachan 2018-06-19 391 /* requested mapping size larger than object size */
8632c614565d0c Alistair Strachan 2018-06-19 392 if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) {
11980c2ac4ccfa Robert Love 2011-12-20 393 ret = -EINVAL;
11980c2ac4ccfa Robert Love 2011-12-20 394 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 395 }
11980c2ac4ccfa Robert Love 2011-12-20 396
11980c2ac4ccfa Robert Love 2011-12-20 397 /* requested protection bits must match our allowed protection mask */
59848d6aded59a Alistair Strachan 2018-06-19 398 if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) &
59848d6aded59a Alistair Strachan 2018-06-19 399 calc_vm_prot_bits(PROT_MASK, 0)) {
11980c2ac4ccfa Robert Love 2011-12-20 400 ret = -EPERM;
11980c2ac4ccfa Robert Love 2011-12-20 401 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 402 }
56f76fc68492af Arve Hjønnevåg 2011-12-20 403 vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask);
11980c2ac4ccfa Robert Love 2011-12-20 404
11980c2ac4ccfa Robert Love 2011-12-20 405 if (!asma->file) {
11980c2ac4ccfa Robert Love 2011-12-20 406 char *name = ASHMEM_NAME_DEF;
11980c2ac4ccfa Robert Love 2011-12-20 407 struct file *vmfile;
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 408 struct inode *inode;
11980c2ac4ccfa Robert Love 2011-12-20 409
11980c2ac4ccfa Robert Love 2011-12-20 410 if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0')
11980c2ac4ccfa Robert Love 2011-12-20 411 name = asma->name;
11980c2ac4ccfa Robert Love 2011-12-20 412
11980c2ac4ccfa Robert Love 2011-12-20 413 /* ... and allocate the backing shmem file */
11980c2ac4ccfa Robert Love 2011-12-20 414 vmfile = shmem_file_setup(name, asma->size, vma->vm_flags);
7f44cb0ba88b40 Viresh Kumar 2015-07-31 415 if (IS_ERR(vmfile)) {
11980c2ac4ccfa Robert Love 2011-12-20 416 ret = PTR_ERR(vmfile);
11980c2ac4ccfa Robert Love 2011-12-20 417 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 418 }
97fbfef6bd5978 Shuxiao Zhang 2017-04-06 419 vmfile->f_mode |= FMODE_LSEEK;
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 420 inode = file_inode(vmfile);
3e338d3c95c735 Suren Baghdasaryan 2020-07-30 421 lockdep_set_class(&inode->i_rwsem, &backing_shmem_inode_class);
11980c2ac4ccfa Robert Love 2011-12-20 422 asma->file = vmfile;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 423 /*
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 424 * override mmap operation of the vmfile so that it can't be
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 425 * remapped which would lead to creation of a new vma with no
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 426 * asma permission checks. Have to override get_unmapped_area
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 427 * as well to prevent VM_BUG_ON check for f_ops modification.
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 428 */
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 429 if (!vmfile_fops.mmap) {
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @430 vmfile_fops = *vmfile->f_op;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 431 vmfile_fops.mmap = ashmem_vmfile_mmap;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 432 vmfile_fops.get_unmapped_area =
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 433 ashmem_vmfile_get_unmapped_area;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 434 }
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 435 vmfile->f_op = &vmfile_fops;
11980c2ac4ccfa Robert Love 2011-12-20 436 }
11980c2ac4ccfa Robert Love 2011-12-20 437 get_file(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 438
11980c2ac4ccfa Robert Love 2011-12-20 439 /*
11980c2ac4ccfa Robert Love 2011-12-20 440 * XXX - Reworked to use shmem_zero_setup() instead of
11980c2ac4ccfa Robert Love 2011-12-20 441 * shmem_set_file while we're in staging. -jstultz
11980c2ac4ccfa Robert Love 2011-12-20 442 */
11980c2ac4ccfa Robert Love 2011-12-20 443 if (vma->vm_flags & VM_SHARED) {
11980c2ac4ccfa Robert Love 2011-12-20 444 ret = shmem_zero_setup(vma);
11980c2ac4ccfa Robert Love 2011-12-20 445 if (ret) {
11980c2ac4ccfa Robert Love 2011-12-20 446 fput(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 447 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 448 }
44960f2a7b63e2 John Stultz 2018-07-31 449 } else {
44960f2a7b63e2 John Stultz 2018-07-31 450 vma_set_anonymous(vma);
11980c2ac4ccfa Robert Love 2011-12-20 451 }
11980c2ac4ccfa Robert Love 2011-12-20 452
295992fb815e79 Christian König 2020-09-14 453 vma_set_file(vma, asma->file);
295992fb815e79 Christian König 2020-09-14 454 /* XXX: merge this with the get_file() above if possible */
295992fb815e79 Christian König 2020-09-14 455 fput(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 456
11980c2ac4ccfa Robert Love 2011-12-20 457 out:
11980c2ac4ccfa Robert Love 2011-12-20 458 mutex_unlock(&ashmem_mutex);
11980c2ac4ccfa Robert Love 2011-12-20 459 return ret;
11980c2ac4ccfa Robert Love 2011-12-20 460 }
11980c2ac4ccfa 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: 29152 bytes --]
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH] staging: android: ashmem: Declared file operation with const keyword
@ 2021-02-14 2:31 ` Thais Camacho
0 siblings, 0 replies; 36+ messages in thread
From: Thais Camacho @ 2021-02-14 2:31 UTC (permalink / raw)
Cc: thaiscamachoo, 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: Thais Camacho <thaiscamachoo@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.20.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH] staging: android: ashmem: Declared file operation with const keyword
@ 2021-02-14 2:31 ` Thais Camacho
0 siblings, 0 replies; 36+ messages in thread
From: Thais Camacho @ 2021-02-14 2:31 UTC (permalink / raw)
Cc: devel, Todd Kjos, Greg Kroah-Hartman, linux-kernel,
thaiscamachoo, Hridya Valsaraju, Arve Hjønnevåg,
Joel Fernandes, Martijn Coenen, Suren Baghdasaryan,
Christian Brauner
Warning found by checkpatch.pl script
Signed-off-by: Thais Camacho <thaiscamachoo@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.20.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with const keyword
2020-03-28 15:15 ` SandeshKenjanaAshok
(?)
@ 2020-03-29 12:54 ` kbuild test robot
-1 siblings, 0 replies; 36+ messages in thread
From: kbuild test robot @ 2020-03-29 12:54 UTC (permalink / raw)
To: SandeshKenjanaAshok
Cc: kbuild-all, sandeshkenjanaashok@gmail.com, Greg Kroah-Hartman,
Arve Hjønnevåg, Todd Kjos, Martijn Coenen,
Joel Fernandes, Christian Brauner, devel, linux-kernel,
sandeshkenjanaashok
[-- Attachment #1: Type: text/plain, Size: 8351 bytes --]
Hi SandeshKenjanaAshok,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v5.6-rc7 next-20200327]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/SandeshKenjanaAshok/staging-android-ashmem-Declared-file-operation-with-const-keyword/20200329-014353
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git e681bb287f40e7a9dbcb04cef80fd87a2511ab86
config: um-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=um
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/staging/android/ashmem.c: In function 'ashmem_mmap':
>> drivers/staging/android/ashmem.c:418:16: error: assignment of read-only variable 'vmfile_fops'
vmfile_fops = *vmfile->f_op;
^
>> drivers/staging/android/ashmem.c:419:21: error: assignment of member 'mmap' in read-only object
vmfile_fops.mmap = ashmem_vmfile_mmap;
^
>> drivers/staging/android/ashmem.c:420:34: error: assignment of member 'get_unmapped_area' in read-only object
vmfile_fops.get_unmapped_area =
^
vim +/vmfile_fops +418 drivers/staging/android/ashmem.c
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 367
11980c2ac4ccfa Robert Love 2011-12-20 368 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
11980c2ac4ccfa Robert Love 2011-12-20 369 {
3e4e9953cadce9 SandeshKenjanaAshok 2020-03-28 370 static const struct file_operations vmfile_fops;
11980c2ac4ccfa Robert Love 2011-12-20 371 struct ashmem_area *asma = file->private_data;
11980c2ac4ccfa Robert Love 2011-12-20 372 int ret = 0;
11980c2ac4ccfa Robert Love 2011-12-20 373
11980c2ac4ccfa Robert Love 2011-12-20 374 mutex_lock(&ashmem_mutex);
11980c2ac4ccfa Robert Love 2011-12-20 375
11980c2ac4ccfa Robert Love 2011-12-20 376 /* user needs to SET_SIZE before mapping */
59848d6aded59a Alistair Strachan 2018-06-19 377 if (!asma->size) {
11980c2ac4ccfa Robert Love 2011-12-20 378 ret = -EINVAL;
11980c2ac4ccfa Robert Love 2011-12-20 379 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 380 }
11980c2ac4ccfa Robert Love 2011-12-20 381
8632c614565d0c Alistair Strachan 2018-06-19 382 /* requested mapping size larger than object size */
8632c614565d0c Alistair Strachan 2018-06-19 383 if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) {
11980c2ac4ccfa Robert Love 2011-12-20 384 ret = -EINVAL;
11980c2ac4ccfa Robert Love 2011-12-20 385 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 386 }
11980c2ac4ccfa Robert Love 2011-12-20 387
11980c2ac4ccfa Robert Love 2011-12-20 388 /* requested protection bits must match our allowed protection mask */
59848d6aded59a Alistair Strachan 2018-06-19 389 if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) &
59848d6aded59a Alistair Strachan 2018-06-19 390 calc_vm_prot_bits(PROT_MASK, 0)) {
11980c2ac4ccfa Robert Love 2011-12-20 391 ret = -EPERM;
11980c2ac4ccfa Robert Love 2011-12-20 392 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 393 }
56f76fc68492af Arve Hjønnevåg 2011-12-20 394 vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask);
11980c2ac4ccfa Robert Love 2011-12-20 395
11980c2ac4ccfa Robert Love 2011-12-20 396 if (!asma->file) {
11980c2ac4ccfa Robert Love 2011-12-20 397 char *name = ASHMEM_NAME_DEF;
11980c2ac4ccfa Robert Love 2011-12-20 398 struct file *vmfile;
11980c2ac4ccfa Robert Love 2011-12-20 399
11980c2ac4ccfa Robert Love 2011-12-20 400 if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0')
11980c2ac4ccfa Robert Love 2011-12-20 401 name = asma->name;
11980c2ac4ccfa Robert Love 2011-12-20 402
11980c2ac4ccfa Robert Love 2011-12-20 403 /* ... and allocate the backing shmem file */
11980c2ac4ccfa Robert Love 2011-12-20 404 vmfile = shmem_file_setup(name, asma->size, vma->vm_flags);
7f44cb0ba88b40 Viresh Kumar 2015-07-31 405 if (IS_ERR(vmfile)) {
11980c2ac4ccfa Robert Love 2011-12-20 406 ret = PTR_ERR(vmfile);
11980c2ac4ccfa Robert Love 2011-12-20 407 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 408 }
97fbfef6bd5978 Shuxiao Zhang 2017-04-06 409 vmfile->f_mode |= FMODE_LSEEK;
11980c2ac4ccfa Robert Love 2011-12-20 410 asma->file = vmfile;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 411 /*
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 412 * override mmap operation of the vmfile so that it can't be
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 413 * remapped which would lead to creation of a new vma with no
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 414 * asma permission checks. Have to override get_unmapped_area
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 415 * as well to prevent VM_BUG_ON check for f_ops modification.
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 416 */
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 417 if (!vmfile_fops.mmap) {
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @418 vmfile_fops = *vmfile->f_op;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @419 vmfile_fops.mmap = ashmem_vmfile_mmap;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @420 vmfile_fops.get_unmapped_area =
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 421 ashmem_vmfile_get_unmapped_area;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 422 }
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 423 vmfile->f_op = &vmfile_fops;
11980c2ac4ccfa Robert Love 2011-12-20 424 }
11980c2ac4ccfa Robert Love 2011-12-20 425 get_file(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 426
11980c2ac4ccfa Robert Love 2011-12-20 427 /*
11980c2ac4ccfa Robert Love 2011-12-20 428 * XXX - Reworked to use shmem_zero_setup() instead of
11980c2ac4ccfa Robert Love 2011-12-20 429 * shmem_set_file while we're in staging. -jstultz
11980c2ac4ccfa Robert Love 2011-12-20 430 */
11980c2ac4ccfa Robert Love 2011-12-20 431 if (vma->vm_flags & VM_SHARED) {
11980c2ac4ccfa Robert Love 2011-12-20 432 ret = shmem_zero_setup(vma);
11980c2ac4ccfa Robert Love 2011-12-20 433 if (ret) {
11980c2ac4ccfa Robert Love 2011-12-20 434 fput(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 435 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 436 }
44960f2a7b63e2 John Stultz 2018-07-31 437 } else {
44960f2a7b63e2 John Stultz 2018-07-31 438 vma_set_anonymous(vma);
11980c2ac4ccfa Robert Love 2011-12-20 439 }
11980c2ac4ccfa Robert Love 2011-12-20 440
11980c2ac4ccfa Robert Love 2011-12-20 441 if (vma->vm_file)
11980c2ac4ccfa Robert Love 2011-12-20 442 fput(vma->vm_file);
11980c2ac4ccfa Robert Love 2011-12-20 443 vma->vm_file = asma->file;
11980c2ac4ccfa Robert Love 2011-12-20 444
11980c2ac4ccfa Robert Love 2011-12-20 445 out:
11980c2ac4ccfa Robert Love 2011-12-20 446 mutex_unlock(&ashmem_mutex);
11980c2ac4ccfa Robert Love 2011-12-20 447 return ret;
11980c2ac4ccfa Robert Love 2011-12-20 448 }
11980c2ac4ccfa Robert Love 2011-12-20 449
:::::: The code at line 418 was first introduced by commit
:::::: 6d67b0290b4b84c477e6a2fc6e005e174d3c7786 staging: android: ashmem: Disallow ashmem memory from being remapped
:::::: TO: Suren Baghdasaryan <surenb@google.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
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: 22352 bytes --]
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with const keyword
@ 2020-03-29 12:54 ` kbuild test robot
0 siblings, 0 replies; 36+ messages in thread
From: kbuild test robot @ 2020-03-29 12:54 UTC (permalink / raw)
To: SandeshKenjanaAshok
Cc: devel, Todd Kjos, sandeshkenjanaashok@gmail.com,
Greg Kroah-Hartman, linux-kernel, sandeshkenjanaashok,
Arve Hjønnevåg, Joel Fernandes, kbuild-all,
Martijn Coenen, Christian Brauner
[-- Attachment #1: Type: text/plain, Size: 8351 bytes --]
Hi SandeshKenjanaAshok,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v5.6-rc7 next-20200327]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/SandeshKenjanaAshok/staging-android-ashmem-Declared-file-operation-with-const-keyword/20200329-014353
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git e681bb287f40e7a9dbcb04cef80fd87a2511ab86
config: um-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=um
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/staging/android/ashmem.c: In function 'ashmem_mmap':
>> drivers/staging/android/ashmem.c:418:16: error: assignment of read-only variable 'vmfile_fops'
vmfile_fops = *vmfile->f_op;
^
>> drivers/staging/android/ashmem.c:419:21: error: assignment of member 'mmap' in read-only object
vmfile_fops.mmap = ashmem_vmfile_mmap;
^
>> drivers/staging/android/ashmem.c:420:34: error: assignment of member 'get_unmapped_area' in read-only object
vmfile_fops.get_unmapped_area =
^
vim +/vmfile_fops +418 drivers/staging/android/ashmem.c
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 367
11980c2ac4ccfa Robert Love 2011-12-20 368 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
11980c2ac4ccfa Robert Love 2011-12-20 369 {
3e4e9953cadce9 SandeshKenjanaAshok 2020-03-28 370 static const struct file_operations vmfile_fops;
11980c2ac4ccfa Robert Love 2011-12-20 371 struct ashmem_area *asma = file->private_data;
11980c2ac4ccfa Robert Love 2011-12-20 372 int ret = 0;
11980c2ac4ccfa Robert Love 2011-12-20 373
11980c2ac4ccfa Robert Love 2011-12-20 374 mutex_lock(&ashmem_mutex);
11980c2ac4ccfa Robert Love 2011-12-20 375
11980c2ac4ccfa Robert Love 2011-12-20 376 /* user needs to SET_SIZE before mapping */
59848d6aded59a Alistair Strachan 2018-06-19 377 if (!asma->size) {
11980c2ac4ccfa Robert Love 2011-12-20 378 ret = -EINVAL;
11980c2ac4ccfa Robert Love 2011-12-20 379 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 380 }
11980c2ac4ccfa Robert Love 2011-12-20 381
8632c614565d0c Alistair Strachan 2018-06-19 382 /* requested mapping size larger than object size */
8632c614565d0c Alistair Strachan 2018-06-19 383 if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) {
11980c2ac4ccfa Robert Love 2011-12-20 384 ret = -EINVAL;
11980c2ac4ccfa Robert Love 2011-12-20 385 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 386 }
11980c2ac4ccfa Robert Love 2011-12-20 387
11980c2ac4ccfa Robert Love 2011-12-20 388 /* requested protection bits must match our allowed protection mask */
59848d6aded59a Alistair Strachan 2018-06-19 389 if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) &
59848d6aded59a Alistair Strachan 2018-06-19 390 calc_vm_prot_bits(PROT_MASK, 0)) {
11980c2ac4ccfa Robert Love 2011-12-20 391 ret = -EPERM;
11980c2ac4ccfa Robert Love 2011-12-20 392 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 393 }
56f76fc68492af Arve Hjønnevåg 2011-12-20 394 vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask);
11980c2ac4ccfa Robert Love 2011-12-20 395
11980c2ac4ccfa Robert Love 2011-12-20 396 if (!asma->file) {
11980c2ac4ccfa Robert Love 2011-12-20 397 char *name = ASHMEM_NAME_DEF;
11980c2ac4ccfa Robert Love 2011-12-20 398 struct file *vmfile;
11980c2ac4ccfa Robert Love 2011-12-20 399
11980c2ac4ccfa Robert Love 2011-12-20 400 if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0')
11980c2ac4ccfa Robert Love 2011-12-20 401 name = asma->name;
11980c2ac4ccfa Robert Love 2011-12-20 402
11980c2ac4ccfa Robert Love 2011-12-20 403 /* ... and allocate the backing shmem file */
11980c2ac4ccfa Robert Love 2011-12-20 404 vmfile = shmem_file_setup(name, asma->size, vma->vm_flags);
7f44cb0ba88b40 Viresh Kumar 2015-07-31 405 if (IS_ERR(vmfile)) {
11980c2ac4ccfa Robert Love 2011-12-20 406 ret = PTR_ERR(vmfile);
11980c2ac4ccfa Robert Love 2011-12-20 407 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 408 }
97fbfef6bd5978 Shuxiao Zhang 2017-04-06 409 vmfile->f_mode |= FMODE_LSEEK;
11980c2ac4ccfa Robert Love 2011-12-20 410 asma->file = vmfile;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 411 /*
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 412 * override mmap operation of the vmfile so that it can't be
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 413 * remapped which would lead to creation of a new vma with no
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 414 * asma permission checks. Have to override get_unmapped_area
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 415 * as well to prevent VM_BUG_ON check for f_ops modification.
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 416 */
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 417 if (!vmfile_fops.mmap) {
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @418 vmfile_fops = *vmfile->f_op;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @419 vmfile_fops.mmap = ashmem_vmfile_mmap;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @420 vmfile_fops.get_unmapped_area =
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 421 ashmem_vmfile_get_unmapped_area;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 422 }
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 423 vmfile->f_op = &vmfile_fops;
11980c2ac4ccfa Robert Love 2011-12-20 424 }
11980c2ac4ccfa Robert Love 2011-12-20 425 get_file(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 426
11980c2ac4ccfa Robert Love 2011-12-20 427 /*
11980c2ac4ccfa Robert Love 2011-12-20 428 * XXX - Reworked to use shmem_zero_setup() instead of
11980c2ac4ccfa Robert Love 2011-12-20 429 * shmem_set_file while we're in staging. -jstultz
11980c2ac4ccfa Robert Love 2011-12-20 430 */
11980c2ac4ccfa Robert Love 2011-12-20 431 if (vma->vm_flags & VM_SHARED) {
11980c2ac4ccfa Robert Love 2011-12-20 432 ret = shmem_zero_setup(vma);
11980c2ac4ccfa Robert Love 2011-12-20 433 if (ret) {
11980c2ac4ccfa Robert Love 2011-12-20 434 fput(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 435 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 436 }
44960f2a7b63e2 John Stultz 2018-07-31 437 } else {
44960f2a7b63e2 John Stultz 2018-07-31 438 vma_set_anonymous(vma);
11980c2ac4ccfa Robert Love 2011-12-20 439 }
11980c2ac4ccfa Robert Love 2011-12-20 440
11980c2ac4ccfa Robert Love 2011-12-20 441 if (vma->vm_file)
11980c2ac4ccfa Robert Love 2011-12-20 442 fput(vma->vm_file);
11980c2ac4ccfa Robert Love 2011-12-20 443 vma->vm_file = asma->file;
11980c2ac4ccfa Robert Love 2011-12-20 444
11980c2ac4ccfa Robert Love 2011-12-20 445 out:
11980c2ac4ccfa Robert Love 2011-12-20 446 mutex_unlock(&ashmem_mutex);
11980c2ac4ccfa Robert Love 2011-12-20 447 return ret;
11980c2ac4ccfa Robert Love 2011-12-20 448 }
11980c2ac4ccfa Robert Love 2011-12-20 449
:::::: The code at line 418 was first introduced by commit
:::::: 6d67b0290b4b84c477e6a2fc6e005e174d3c7786 staging: android: ashmem: Disallow ashmem memory from being remapped
:::::: TO: Suren Baghdasaryan <surenb@google.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
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: 22352 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] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with const keyword
@ 2020-03-29 12:54 ` kbuild test robot
0 siblings, 0 replies; 36+ messages in thread
From: kbuild test robot @ 2020-03-29 12:54 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 8484 bytes --]
Hi SandeshKenjanaAshok,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v5.6-rc7 next-20200327]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/SandeshKenjanaAshok/staging-android-ashmem-Declared-file-operation-with-const-keyword/20200329-014353
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git e681bb287f40e7a9dbcb04cef80fd87a2511ab86
config: um-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.5.0-5) 7.5.0
reproduce:
# save the attached .config to linux build tree
make ARCH=um
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/staging/android/ashmem.c: In function 'ashmem_mmap':
>> drivers/staging/android/ashmem.c:418:16: error: assignment of read-only variable 'vmfile_fops'
vmfile_fops = *vmfile->f_op;
^
>> drivers/staging/android/ashmem.c:419:21: error: assignment of member 'mmap' in read-only object
vmfile_fops.mmap = ashmem_vmfile_mmap;
^
>> drivers/staging/android/ashmem.c:420:34: error: assignment of member 'get_unmapped_area' in read-only object
vmfile_fops.get_unmapped_area =
^
vim +/vmfile_fops +418 drivers/staging/android/ashmem.c
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 367
11980c2ac4ccfa Robert Love 2011-12-20 368 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
11980c2ac4ccfa Robert Love 2011-12-20 369 {
3e4e9953cadce9 SandeshKenjanaAshok 2020-03-28 370 static const struct file_operations vmfile_fops;
11980c2ac4ccfa Robert Love 2011-12-20 371 struct ashmem_area *asma = file->private_data;
11980c2ac4ccfa Robert Love 2011-12-20 372 int ret = 0;
11980c2ac4ccfa Robert Love 2011-12-20 373
11980c2ac4ccfa Robert Love 2011-12-20 374 mutex_lock(&ashmem_mutex);
11980c2ac4ccfa Robert Love 2011-12-20 375
11980c2ac4ccfa Robert Love 2011-12-20 376 /* user needs to SET_SIZE before mapping */
59848d6aded59a Alistair Strachan 2018-06-19 377 if (!asma->size) {
11980c2ac4ccfa Robert Love 2011-12-20 378 ret = -EINVAL;
11980c2ac4ccfa Robert Love 2011-12-20 379 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 380 }
11980c2ac4ccfa Robert Love 2011-12-20 381
8632c614565d0c Alistair Strachan 2018-06-19 382 /* requested mapping size larger than object size */
8632c614565d0c Alistair Strachan 2018-06-19 383 if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) {
11980c2ac4ccfa Robert Love 2011-12-20 384 ret = -EINVAL;
11980c2ac4ccfa Robert Love 2011-12-20 385 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 386 }
11980c2ac4ccfa Robert Love 2011-12-20 387
11980c2ac4ccfa Robert Love 2011-12-20 388 /* requested protection bits must match our allowed protection mask */
59848d6aded59a Alistair Strachan 2018-06-19 389 if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) &
59848d6aded59a Alistair Strachan 2018-06-19 390 calc_vm_prot_bits(PROT_MASK, 0)) {
11980c2ac4ccfa Robert Love 2011-12-20 391 ret = -EPERM;
11980c2ac4ccfa Robert Love 2011-12-20 392 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 393 }
56f76fc68492af Arve Hjønnevåg 2011-12-20 394 vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask);
11980c2ac4ccfa Robert Love 2011-12-20 395
11980c2ac4ccfa Robert Love 2011-12-20 396 if (!asma->file) {
11980c2ac4ccfa Robert Love 2011-12-20 397 char *name = ASHMEM_NAME_DEF;
11980c2ac4ccfa Robert Love 2011-12-20 398 struct file *vmfile;
11980c2ac4ccfa Robert Love 2011-12-20 399
11980c2ac4ccfa Robert Love 2011-12-20 400 if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0')
11980c2ac4ccfa Robert Love 2011-12-20 401 name = asma->name;
11980c2ac4ccfa Robert Love 2011-12-20 402
11980c2ac4ccfa Robert Love 2011-12-20 403 /* ... and allocate the backing shmem file */
11980c2ac4ccfa Robert Love 2011-12-20 404 vmfile = shmem_file_setup(name, asma->size, vma->vm_flags);
7f44cb0ba88b40 Viresh Kumar 2015-07-31 405 if (IS_ERR(vmfile)) {
11980c2ac4ccfa Robert Love 2011-12-20 406 ret = PTR_ERR(vmfile);
11980c2ac4ccfa Robert Love 2011-12-20 407 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 408 }
97fbfef6bd5978 Shuxiao Zhang 2017-04-06 409 vmfile->f_mode |= FMODE_LSEEK;
11980c2ac4ccfa Robert Love 2011-12-20 410 asma->file = vmfile;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 411 /*
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 412 * override mmap operation of the vmfile so that it can't be
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 413 * remapped which would lead to creation of a new vma with no
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 414 * asma permission checks. Have to override get_unmapped_area
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 415 * as well to prevent VM_BUG_ON check for f_ops modification.
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 416 */
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 417 if (!vmfile_fops.mmap) {
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @418 vmfile_fops = *vmfile->f_op;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @419 vmfile_fops.mmap = ashmem_vmfile_mmap;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 @420 vmfile_fops.get_unmapped_area =
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 421 ashmem_vmfile_get_unmapped_area;
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 422 }
6d67b0290b4b84 Suren Baghdasaryan 2020-01-27 423 vmfile->f_op = &vmfile_fops;
11980c2ac4ccfa Robert Love 2011-12-20 424 }
11980c2ac4ccfa Robert Love 2011-12-20 425 get_file(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 426
11980c2ac4ccfa Robert Love 2011-12-20 427 /*
11980c2ac4ccfa Robert Love 2011-12-20 428 * XXX - Reworked to use shmem_zero_setup() instead of
11980c2ac4ccfa Robert Love 2011-12-20 429 * shmem_set_file while we're in staging. -jstultz
11980c2ac4ccfa Robert Love 2011-12-20 430 */
11980c2ac4ccfa Robert Love 2011-12-20 431 if (vma->vm_flags & VM_SHARED) {
11980c2ac4ccfa Robert Love 2011-12-20 432 ret = shmem_zero_setup(vma);
11980c2ac4ccfa Robert Love 2011-12-20 433 if (ret) {
11980c2ac4ccfa Robert Love 2011-12-20 434 fput(asma->file);
11980c2ac4ccfa Robert Love 2011-12-20 435 goto out;
11980c2ac4ccfa Robert Love 2011-12-20 436 }
44960f2a7b63e2 John Stultz 2018-07-31 437 } else {
44960f2a7b63e2 John Stultz 2018-07-31 438 vma_set_anonymous(vma);
11980c2ac4ccfa Robert Love 2011-12-20 439 }
11980c2ac4ccfa Robert Love 2011-12-20 440
11980c2ac4ccfa Robert Love 2011-12-20 441 if (vma->vm_file)
11980c2ac4ccfa Robert Love 2011-12-20 442 fput(vma->vm_file);
11980c2ac4ccfa Robert Love 2011-12-20 443 vma->vm_file = asma->file;
11980c2ac4ccfa Robert Love 2011-12-20 444
11980c2ac4ccfa Robert Love 2011-12-20 445 out:
11980c2ac4ccfa Robert Love 2011-12-20 446 mutex_unlock(&ashmem_mutex);
11980c2ac4ccfa Robert Love 2011-12-20 447 return ret;
11980c2ac4ccfa Robert Love 2011-12-20 448 }
11980c2ac4ccfa Robert Love 2011-12-20 449
:::::: The code at line 418 was first introduced by commit
:::::: 6d67b0290b4b84c477e6a2fc6e005e174d3c7786 staging: android: ashmem: Disallow ashmem memory from being remapped
:::::: TO: Suren Baghdasaryan <surenb@google.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
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: 22352 bytes --]
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with const keyword
2020-03-28 15:15 ` SandeshKenjanaAshok
@ 2020-03-29 6:58 ` Greg Kroah-Hartman
-1 siblings, 0 replies; 36+ messages in thread
From: Greg Kroah-Hartman @ 2020-03-29 6:58 UTC (permalink / raw)
To: SandeshKenjanaAshok
Cc: Arve Hjønnevåg, Todd Kjos, Martijn Coenen,
Joel Fernandes, Christian Brauner, devel, linux-kernel
On Sat, Mar 28, 2020 at 04:15:23PM +0100, SandeshKenjanaAshok wrote:
> Warning found by checkpatch.pl script.
>
> Signed-off-by: SandeshKenjanaAshok <sandeshkenjanaashok@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 8044510d8ec6..fbb6ac9ba1ab 100644
> --- a/drivers/staging/android/ashmem.c
> +++ b/drivers/staging/android/ashmem.c
> @@ -367,7 +367,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.17.1
>
Did you try to build this change? Please do so.
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] staging: android: ashmem: Declared file operation with const keyword
@ 2020-03-29 6:58 ` Greg Kroah-Hartman
0 siblings, 0 replies; 36+ messages in thread
From: Greg Kroah-Hartman @ 2020-03-29 6:58 UTC (permalink / raw)
To: SandeshKenjanaAshok
Cc: devel, Todd Kjos, linux-kernel, Arve Hjønnevåg,
Joel Fernandes, Martijn Coenen, Christian Brauner
On Sat, Mar 28, 2020 at 04:15:23PM +0100, SandeshKenjanaAshok wrote:
> Warning found by checkpatch.pl script.
>
> Signed-off-by: SandeshKenjanaAshok <sandeshkenjanaashok@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 8044510d8ec6..fbb6ac9ba1ab 100644
> --- a/drivers/staging/android/ashmem.c
> +++ b/drivers/staging/android/ashmem.c
> @@ -367,7 +367,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.17.1
>
Did you try to build this change? Please do so.
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH] staging: android: ashmem: Declared file operation with const keyword
@ 2020-03-28 15:15 ` SandeshKenjanaAshok
0 siblings, 0 replies; 36+ messages in thread
From: SandeshKenjanaAshok @ 2020-03-28 15:15 UTC (permalink / raw)
Cc: sandeshkenjanaashok, Greg Kroah-Hartman,
Arve Hjønnevåg, Todd Kjos, Martijn Coenen,
Joel Fernandes, Christian Brauner, devel, linux-kernel
Warning found by checkpatch.pl script.
Signed-off-by: SandeshKenjanaAshok <sandeshkenjanaashok@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 8044510d8ec6..fbb6ac9ba1ab 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -367,7 +367,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.17.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH] staging: android: ashmem: Declared file operation with const keyword
@ 2020-03-28 15:15 ` SandeshKenjanaAshok
0 siblings, 0 replies; 36+ messages in thread
From: SandeshKenjanaAshok @ 2020-03-28 15:15 UTC (permalink / raw)
Cc: devel, Todd Kjos, Greg Kroah-Hartman, linux-kernel,
sandeshkenjanaashok, Arve Hjønnevåg, Joel Fernandes,
Martijn Coenen, Christian Brauner
Warning found by checkpatch.pl script.
Signed-off-by: SandeshKenjanaAshok <sandeshkenjanaashok@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 8044510d8ec6..fbb6ac9ba1ab 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -367,7 +367,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.17.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 36+ messages in thread
end of thread, other threads:[~2022-01-24 12:27 UTC | newest]
Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-28 5:13 [PATCH] staging: android: ashmem: Declared file operation with const keyword jovin555
2020-12-28 5:13 ` jovin555
2020-12-28 6:35 ` Greg Kroah-Hartman
2020-12-28 6:35 ` Greg Kroah-Hartman
2021-01-05 11:52 ` Dan Carpenter
2021-01-05 11:52 ` Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2022-01-24 7:09 ratnesh-r1
2022-01-24 7:39 ` Greg Kroah-Hartman
2022-01-24 11:20 ` kernel test robot
2022-01-24 11:20 ` kernel test robot
2022-01-24 12:27 ` kernel test robot
2022-01-24 12:27 ` kernel test robot
2021-05-19 8:19 [PATCH] staging: android: ashmem: Declared file operation with 'const' keyword Hriday Hegde
2021-05-19 8:19 ` Hriday Hegde
2021-05-19 8:31 ` Greg Kroah-Hartman
2021-05-19 9:30 ` Hriday Hegde
2021-05-19 9:50 ` Greg Kroah-Hartman
2021-05-19 14:36 ` Hriday Hegde
2021-05-19 14:51 ` Fabio Aiuto
2021-05-19 15:54 ` Hriday Hegde
2021-05-19 14:55 ` Greg Kroah-Hartman
2021-05-19 15:56 ` Hriday Hegde
2021-02-14 2:31 [PATCH] staging: android: ashmem: Declared file operation with const keyword Thais Camacho
2021-02-14 2:31 ` Thais Camacho
2021-02-14 4:49 ` kernel test robot
2021-02-14 4:49 ` kernel test robot
2021-02-14 4:49 ` kernel test robot
2021-02-14 8:21 ` Greg Kroah-Hartman
2021-02-14 8:21 ` Greg Kroah-Hartman
2020-03-28 15:15 SandeshKenjanaAshok
2020-03-28 15:15 ` SandeshKenjanaAshok
2020-03-29 6:58 ` Greg Kroah-Hartman
2020-03-29 6:58 ` Greg Kroah-Hartman
2020-03-29 12:54 ` kbuild test robot
2020-03-29 12:54 ` kbuild test robot
2020-03-29 12:54 ` kbuild 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.