lkml.org 
[lkml]   [2021]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[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'}
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
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2021-07-11 08:19    [W:6.785 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site