From: kernel test robot <lkp@intel.com>
To: kiransuren@osuosl.org, kirank.suren@gmail.com,
gregkh@linuxfoundation.org
Cc: devel@driverdev.osuosl.org, kiransuren <kirank.suren@gmail.com>,
kbuild-all@lists.01.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Staging: android: ashmem: changed struct file_operations to const file_operations
Date: Fri, 16 Oct 2020 14:20:55 +0800 [thread overview]
Message-ID: <202010161449.Iq6Y3nNE-lkp@intel.com> (raw)
In-Reply-To: <20201016051111.1947-1-kirank.suren@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 5507 bytes --]
Hi,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on staging/staging-testing]
url: https://github.com/0day-ci/linux/commits/kiransuren-osuosl-org/Staging-android-ashmem-changed-struct-file_operations-to-const-file_operations/20201016-131238
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 726eb70e0d34dc4bc4dada71f52bba8ed638431e
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/1496e5f2103cc6f96af90aaf323cf92f018dcf41
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review kiransuren-osuosl-org/Staging-android-ashmem-changed-struct-file_operations-to-const-file_operations/20201016-131238
git checkout 1496e5f2103cc6f96af90aaf323cf92f018dcf41
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=xtensa
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:379:15: error: unknown type name 'file_operations'
379 | static const file_operations vmfile_fops;
| ^~~~~~~~~~~~~~~
>> drivers/staging/android/ashmem.c:429:19: error: request for member 'mmap' in something not a structure or union
429 | if (!vmfile_fops.mmap) {
| ^
>> drivers/staging/android/ashmem.c:430:16: error: assignment of read-only variable 'vmfile_fops'
430 | vmfile_fops = *vmfile->f_op;
| ^
drivers/staging/android/ashmem.c:431:15: error: request for member 'mmap' in something not a structure or union
431 | vmfile_fops.mmap = ashmem_vmfile_mmap;
| ^
>> drivers/staging/android/ashmem.c:432:15: error: request for member 'get_unmapped_area' in something not a structure or union
432 | vmfile_fops.get_unmapped_area =
| ^
>> drivers/staging/android/ashmem.c:435:16: error: assignment to 'const struct file_operations *' from incompatible pointer type 'const int *' [-Werror=incompatible-pointer-types]
435 | vmfile->f_op = &vmfile_fops;
| ^
cc1: some warnings being treated as errors
vim +/file_operations +379 drivers/staging/android/ashmem.c
376
377 static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
378 {
> 379 static const file_operations vmfile_fops;
380 struct ashmem_area *asma = file->private_data;
381 int ret = 0;
382
383 mutex_lock(&ashmem_mutex);
384
385 /* user needs to SET_SIZE before mapping */
386 if (!asma->size) {
387 ret = -EINVAL;
388 goto out;
389 }
390
391 /* requested mapping size larger than object size */
392 if (vma->vm_end - vma->vm_start > PAGE_ALIGN(asma->size)) {
393 ret = -EINVAL;
394 goto out;
395 }
396
397 /* requested protection bits must match our allowed protection mask */
398 if ((vma->vm_flags & ~calc_vm_prot_bits(asma->prot_mask, 0)) &
399 calc_vm_prot_bits(PROT_MASK, 0)) {
400 ret = -EPERM;
401 goto out;
402 }
403 vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask);
404
405 if (!asma->file) {
406 char *name = ASHMEM_NAME_DEF;
407 struct file *vmfile;
408 struct inode *inode;
409
410 if (asma->name[ASHMEM_NAME_PREFIX_LEN] != '\0')
411 name = asma->name;
412
413 /* ... and allocate the backing shmem file */
414 vmfile = shmem_file_setup(name, asma->size, vma->vm_flags);
415 if (IS_ERR(vmfile)) {
416 ret = PTR_ERR(vmfile);
417 goto out;
418 }
419 vmfile->f_mode |= FMODE_LSEEK;
420 inode = file_inode(vmfile);
421 lockdep_set_class(&inode->i_rwsem, &backing_shmem_inode_class);
422 asma->file = vmfile;
423 /*
424 * override mmap operation of the vmfile so that it can't be
425 * remapped which would lead to creation of a new vma with no
426 * asma permission checks. Have to override get_unmapped_area
427 * as well to prevent VM_BUG_ON check for f_ops modification.
428 */
> 429 if (!vmfile_fops.mmap) {
> 430 vmfile_fops = *vmfile->f_op;
431 vmfile_fops.mmap = ashmem_vmfile_mmap;
> 432 vmfile_fops.get_unmapped_area =
433 ashmem_vmfile_get_unmapped_area;
434 }
> 435 vmfile->f_op = &vmfile_fops;
436 }
437 get_file(asma->file);
438
439 /*
440 * XXX - Reworked to use shmem_zero_setup() instead of
441 * shmem_set_file while we're in staging. -jstultz
442 */
443 if (vma->vm_flags & VM_SHARED) {
444 ret = shmem_zero_setup(vma);
445 if (ret) {
446 fput(asma->file);
447 goto out;
448 }
449 } else {
450 vma_set_anonymous(vma);
451 }
452
453 if (vma->vm_file)
454 fput(vma->vm_file);
455 vma->vm_file = asma->file;
456
457 out:
458 mutex_unlock(&ashmem_mutex);
459 return ret;
460 }
461
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 65636 bytes --]
[-- Attachment #3: Type: text/plain, Size: 169 bytes --]
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
next prev parent reply other threads:[~2020-10-16 6:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-16 5:11 [PATCH] Staging: android: ashmem: changed struct file_operations to const file_operations kiransuren, kirank.suren
2020-10-16 5:16 ` Randy Dunlap
2020-10-16 5:17 ` Greg KH
[not found] ` <CAMHzSAHVtv+BuYgCAdbB26J3EHTdEyH3ZZUfP-g3zftppzJOkw@mail.gmail.com>
2020-10-16 6:18 ` Greg KH
2020-10-16 6:20 ` kernel test robot [this message]
2020-10-16 7:34 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202010161449.Iq6Y3nNE-lkp@intel.com \
--to=lkp@intel.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=kbuild-all@lists.01.org \
--cc=kirank.suren@gmail.com \
--cc=kiransuren@osuosl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).