mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: drivers/usb/gadget/function/f_fs.c:899:13: sparse: sparse: non size-preserving integer to pointer cast
Date: Wed, 8 Jul 2020 23:57:41 +0800	[thread overview]
Message-ID: <202007082338.NuYfIj1I%lkp@intel.com> (raw)

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

Hi Masahiro,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   dcde237b9b0eb1d19306e6f48c0a4e058907619f
commit: df8df5e4bc37e39010cfdf5d50cf726fe08aae5b usb: get rid of 'choice' for legacy gadget drivers
date:   4 months ago
config: s390-randconfig-s031-20200708 (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.2-37-gc9676a3b-dirty
        git checkout df8df5e4bc37e39010cfdf5d50cf726fe08aae5b
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=s390 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

   drivers/usb/gadget/function/f_fs.c:2857:32: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] wMaxPacketSize @@     got restricted __le16 [usertype] wMaxPacketSize @@
   drivers/usb/gadget/function/f_fs.c:2857:32: sparse:     expected unsigned short [usertype] wMaxPacketSize
   drivers/usb/gadget/function/f_fs.c:2857:32: sparse:     got restricted __le16 [usertype] wMaxPacketSize
   drivers/usb/gadget/function/f_fs.c:2882:36: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le16 [usertype] wMaxPacketSize @@     got unsigned short [usertype] wMaxPacketSize @@
   drivers/usb/gadget/function/f_fs.c:2882:36: sparse:     expected restricted __le16 [usertype] wMaxPacketSize
   drivers/usb/gadget/function/f_fs.c:2882:36: sparse:     got unsigned short [usertype] wMaxPacketSize
>> drivers/usb/gadget/function/f_fs.c:899:13: sparse: sparse: non size-preserving integer to pointer cast
   drivers/usb/gadget/function/f_fs.c:937:13: sparse: sparse: non size-preserving integer to pointer cast

vim +899 drivers/usb/gadget/function/f_fs.c

a9e6f83c2df1991 Michal Nazarewicz 2016-10-04  871  
9353afbbfa7b107 Michal Nazarewicz 2016-05-21  872  /* Assumes epfile->mutex is held. */
9353afbbfa7b107 Michal Nazarewicz 2016-05-21  873  static ssize_t __ffs_epfile_read_buffered(struct ffs_epfile *epfile,
9353afbbfa7b107 Michal Nazarewicz 2016-05-21  874  					  struct iov_iter *iter)
9353afbbfa7b107 Michal Nazarewicz 2016-05-21  875  {
a9e6f83c2df1991 Michal Nazarewicz 2016-10-04  876  	/*
a9e6f83c2df1991 Michal Nazarewicz 2016-10-04  877  	 * Null out epfile->read_buffer so ffs_func_eps_disable does not free
a9e6f83c2df1991 Michal Nazarewicz 2016-10-04  878  	 * the buffer while we are using it.  See comment in struct ffs_epfile
a9e6f83c2df1991 Michal Nazarewicz 2016-10-04  879  	 * for full read_buffer pointer synchronisation story.
a9e6f83c2df1991 Michal Nazarewicz 2016-10-04  880  	 */
a9e6f83c2df1991 Michal Nazarewicz 2016-10-04  881  	struct ffs_buffer *buf = xchg(&epfile->read_buffer, NULL);
9353afbbfa7b107 Michal Nazarewicz 2016-05-21  882  	ssize_t ret;
a9e6f83c2df1991 Michal Nazarewicz 2016-10-04  883  	if (!buf || buf == READ_BUFFER_DROP)
9353afbbfa7b107 Michal Nazarewicz 2016-05-21  884  		return 0;
9353afbbfa7b107 Michal Nazarewicz 2016-05-21  885  
9353afbbfa7b107 Michal Nazarewicz 2016-05-21  886  	ret = copy_to_iter(buf->data, buf->length, iter);
9353afbbfa7b107 Michal Nazarewicz 2016-05-21  887  	if (buf->length == ret) {
9353afbbfa7b107 Michal Nazarewicz 2016-05-21  888  		kfree(buf);
a9e6f83c2df1991 Michal Nazarewicz 2016-10-04  889  		return ret;
a9e6f83c2df1991 Michal Nazarewicz 2016-10-04  890  	}
a9e6f83c2df1991 Michal Nazarewicz 2016-10-04  891  
a9e6f83c2df1991 Michal Nazarewicz 2016-10-04  892  	if (unlikely(iov_iter_count(iter))) {
9353afbbfa7b107 Michal Nazarewicz 2016-05-21  893  		ret = -EFAULT;
9353afbbfa7b107 Michal Nazarewicz 2016-05-21  894  	} else {
9353afbbfa7b107 Michal Nazarewicz 2016-05-21  895  		buf->length -= ret;
9353afbbfa7b107 Michal Nazarewicz 2016-05-21  896  		buf->data += ret;
9353afbbfa7b107 Michal Nazarewicz 2016-05-21  897  	}
a9e6f83c2df1991 Michal Nazarewicz 2016-10-04  898  
a9e6f83c2df1991 Michal Nazarewicz 2016-10-04 @899  	if (cmpxchg(&epfile->read_buffer, NULL, buf))
a9e6f83c2df1991 Michal Nazarewicz 2016-10-04  900  		kfree(buf);
a9e6f83c2df1991 Michal Nazarewicz 2016-10-04  901  
9353afbbfa7b107 Michal Nazarewicz 2016-05-21  902  	return ret;
9353afbbfa7b107 Michal Nazarewicz 2016-05-21  903  }
9353afbbfa7b107 Michal Nazarewicz 2016-05-21  904  

:::::: The code at line 899 was first introduced by commit
:::::: a9e6f83c2df199187a5248f824f31b6787ae23ae usb: gadget: f_fs: stop sleeping in ffs_func_eps_disable

:::::: TO: Michal Nazarewicz <mina86@mina86.com>
:::::: CC: Felipe Balbi <felipe.balbi@linux.intel.com>

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

                 reply	other threads:[~2020-07-08 15:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202007082338.NuYfIj1I%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@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

all inboxes | Powered by JetHome®