Message ID | 20210715194911.8267-1-saptarshi.patra.22@gmail.com |
---|---|
State | New |
Headers | show |
Series | media: usb: uvc: uvc_driver: Added a function pr_info() in uvc_driver and staging: android: Decleared file operation with const keyword in android keyword | expand |
Hi Saptarshi,
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/Saptarshi-Patra/media-usb-uvc-uvc_driver-Added-a-function-pr_info-in-uvc_driver-and-staging-android-Decleared-file-operation-with-const-/20210716-040300
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 77d34a4683b053108ecd466cc7c4193b45805528
config: arm-randconfig-r016-20210715 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 0e49c54a8cbd3e779e5526a5888c683c01cc3c50)
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 arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/0day-ci/linux/commit/9bcd3c935ac7432af5857cd74814963908d01a5d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Saptarshi-Patra/media-usb-uvc-uvc_driver-Added-a-function-pr_info-in-uvc_driver-and-staging-android-Decleared-file-operation-with-const-/20210716-040300
git checkout 9bcd3c935ac7432af5857cd74814963908d01a5d
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=arm 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 {
9bcd3c935ac743 Saptarshi Patra 2021-07-16 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
Hi Saptarshi, 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/Saptarshi-Patra/media-usb-uvc-uvc_driver-Added-a-function-pr_info-in-uvc_driver-and-staging-android-Decleared-file-operation-with-const-/20210716-040300 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 77d34a4683b053108ecd466cc7c4193b45805528 config: parisc-buildonly-randconfig-r001-20210715 (attached as .config) compiler: hppa-linux-gcc (GCC) 10.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/9bcd3c935ac7432af5857cd74814963908d01a5d git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Saptarshi-Patra/media-usb-uvc-uvc_driver-Added-a-function-pr_info-in-uvc_driver-and-staging-android-Decleared-file-operation-with-const-/20210716-040300 git checkout 9bcd3c935ac7432af5857cd74814963908d01a5d # save the attached .config to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=parisc 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: 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 = | ^ drivers/staging/android/ashmem.c:409:17: warning: variable 'inode' set but not used [-Wunused-but-set-variable] 409 | struct inode *inode; | ^~~~~ 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 { 9bcd3c935ac743 Saptarshi Patra 2021-07-16 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
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 9a791d8ef200..0b47ca75091b 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -2352,7 +2352,7 @@ static int uvc_probe(struct usb_interface *intf, (const struct uvc_device_info *)id->driver_info; int function; int ret; - + pr_info("I changed uvcvideo driver in the Linux Kernel\n"); /* Allocate memory for the device and initialize it. */ dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (dev == NULL) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index ddbde3f8430e..4c6b420fbf4d 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;
media: usb: uvc: uvc_driver: Decleared a function called pr_info() with a string input "I changed uvcvideo driver in the Linux Kernel" Added the function pr_info() to see the message / input string using dmesg staging: android: Decleared file operation with const keyword Warning found by the checkpatch.pl script Signed-off-by: Saptarshi Patra <saptarshi.patra.22@gmail.com> --- drivers/media/usb/uvc/uvc_driver.c | 2 +- drivers/staging/android/ashmem.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)