driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Dhiraj Sharma <dhiraj.sharma0024@gmail.com>,
	gregkh@linuxfoundation.org, arve@android.com, tkjos@android.com,
	maco@android.com, joel@joelfernandes.org, christian@brauner.io,
	hridya@google.com, surenb@google.com
Cc: devel@driverdev.osuosl.org,
	Dhiraj Sharma <dhiraj.sharma0024@gmail.com>,
	kbuild-all@lists.01.org
Subject: Re: [PATCH] staging: android: ashmem: used const keyword
Date: Thu, 30 Jul 2020 05:31:05 +0800	[thread overview]
Message-ID: <202007300507.pnXg8TyK%lkp@intel.com> (raw)
In-Reply-To: <20200728175935.2130-1-dhiraj.sharma0024@gmail.com>

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

Hi Dhiraj,

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/Dhiraj-Sharma/staging-android-ashmem-used-const-keyword/20200729-020222
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 11536442a3b4e1de6890ea5e805908debb74f94a
config: i386-randconfig-r012-20200729 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce (this is a W=1 build):
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

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:418:16: error: assignment of read-only variable 'vmfile_fops'
     418 |    vmfile_fops = *vmfile->f_op;
         |                ^
>> drivers/staging/android/ashmem.c:419:21: error: assignment of member 'mmap' in read-only object
     419 |    vmfile_fops.mmap = ashmem_vmfile_mmap;
         |                     ^
>> drivers/staging/android/ashmem.c:420:34: error: assignment of member 'get_unmapped_area' in read-only object
     420 |    vmfile_fops.get_unmapped_area =
         |                                  ^

vim +/vmfile_fops +418 drivers/staging/android/ashmem.c

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

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

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

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

  parent reply	other threads:[~2020-07-29 21:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-28 17:59 [PATCH] staging: android: ashmem: used const keyword Dhiraj Sharma
2020-07-28 18:04 ` Joe Perches
2020-07-28 18:25 ` Greg KH
2020-07-28 18:35   ` Dhiraj Sharma
2020-07-29 21:31 ` kernel test robot [this message]
2020-07-29 21:45 ` kernel test robot
2020-08-05  8:43 ` 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=202007300507.pnXg8TyK%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=arve@android.com \
    --cc=christian@brauner.io \
    --cc=devel@driverdev.osuosl.org \
    --cc=dhiraj.sharma0024@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hridya@google.com \
    --cc=joel@joelfernandes.org \
    --cc=kbuild-all@lists.01.org \
    --cc=maco@android.com \
    --cc=surenb@google.com \
    --cc=tkjos@android.com \
    /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).