linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [linux-stable-rc:linux-4.4.y 1449/1774] drivers/input/joydev.c:451:16: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long unsigned int'}
@ 2021-07-11  6:18 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-07-11  6:18 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: kbuild-all, linux-kernel, Greg Kroah-Hartman, Dmitry Torokhov

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

Hi Dan,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
head:   38c92ba3580f0d00e57a55caf8f880aa1a0f2a50
commit: ade5180681d778d36b569ad35cc175ab22196c5f [1449/1774] Input: joydev - prevent potential read overflow in ioctl
config: mips-randconfig-r013-20210705 (attached as .config)
compiler: mips64el-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://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/commit/?id=ade5180681d778d36b569ad35cc175ab22196c5f
        git remote add linux-stable-rc https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
        git fetch --no-tags linux-stable-rc linux-4.4.y
        git checkout ade5180681d778d36b569ad35cc175ab22196c5f
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips 

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

All warnings (new ones prefixed by >>):

   drivers/input/joydev.c: In function 'joydev_handle_JSIOCSAXMAP':
>> drivers/input/joydev.c:451:16: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
     451 |  for (i = 0; i < len && i < joydev->nabs; i++) {
         |                ^
   drivers/input/joydev.c: In function 'joydev_handle_JSIOCSBTNMAP':
   drivers/input/joydev.c:485:16: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
     485 |  for (i = 0; i < (len / 2) && i < joydev->nkey; i++) {
         |                ^
   drivers/input/joydev.c: In function 'joydev_ioctl_common':
   drivers/input/joydev.c:566:52: warning: operand of ?: changes signedness from 'int' to 'size_t' {aka 'long unsigned int'} due to unsignedness of other operand [-Wsign-compare]
     566 |   return copy_to_user(argp, joydev->abspam, len) ? -EFAULT : len;
   drivers/input/joydev.c:573:52: warning: operand of ?: changes signedness from 'int' to 'size_t' {aka 'long unsigned int'} due to unsignedness of other operand [-Wsign-compare]
     573 |   return copy_to_user(argp, joydev->keypam, len) ? -EFAULT : len;
   drivers/input/joydev.c:581:42: warning: operand of ?: changes signedness from 'int' to 'size_t' {aka 'long unsigned int'} due to unsignedness of other operand [-Wsign-compare]
     581 |   return copy_to_user(argp, name, len) ? -EFAULT : len;


vim +451 drivers/input/joydev.c

   436	
   437	static int joydev_handle_JSIOCSAXMAP(struct joydev *joydev,
   438					     void __user *argp, size_t len)
   439	{
   440		__u8 *abspam;
   441		int i;
   442		int retval = 0;
   443	
   444		len = min(len, sizeof(joydev->abspam));
   445	
   446		/* Validate the map. */
   447		abspam = memdup_user(argp, len);
   448		if (IS_ERR(abspam))
   449			return PTR_ERR(abspam);
   450	
 > 451		for (i = 0; i < len && i < joydev->nabs; i++) {
   452			if (abspam[i] > ABS_MAX) {
   453				retval = -EINVAL;
   454				goto out;
   455			}
   456		}
   457	
   458		memcpy(joydev->abspam, abspam, len);
   459	
   460		for (i = 0; i < joydev->nabs; i++)
   461			joydev->absmap[joydev->abspam[i]] = i;
   462	
   463	 out:
   464		kfree(abspam);
   465		return retval;
   466	}
   467	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-11  6:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-11  6:18 [linux-stable-rc:linux-4.4.y 1449/1774] drivers/input/joydev.c:451:16: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long unsigned int'} kernel test robot

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).