From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [linux-stable-rc:linux-4.4.y 1449/1774] drivers/input/joydev.c:485:16: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int'
Date: Mon, 19 Jul 2021 11:39:16 +0800 [thread overview]
Message-ID: <202107191112.AwqoFW63-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 4254 bytes --]
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: h8300-randconfig-r031-20210718 (attached as .config)
compiler: h8300-linux-gcc (GCC) 10.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-10.3.0 make.cross ARCH=h8300
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 >>):
In file included from arch/h8300/include/generated/asm/uaccess.h:1,
from include/linux/poll.h:11,
from drivers/input/joydev.c:27:
include/asm-generic/uaccess.h: In function '__put_user_fn':
include/asm-generic/uaccess.h:178:16: warning: operand of '?:' changes signedness from 'int' to 'size_t' {aka 'long unsigned int'} due to unsignedness of other operand [-Wsign-compare]
178 | return size ? -EFAULT : size;
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 '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 +485 drivers/input/joydev.c
467
468 static int joydev_handle_JSIOCSBTNMAP(struct joydev *joydev,
469 void __user *argp, size_t len)
470 {
471 __u16 *keypam;
472 int i;
473 int retval = 0;
474
475 if (len % sizeof(*keypam))
476 return -EINVAL;
477
478 len = min(len, sizeof(joydev->keypam));
479
480 /* Validate the map. */
481 keypam = memdup_user(argp, len);
482 if (IS_ERR(keypam))
483 return PTR_ERR(keypam);
484
> 485 for (i = 0; i < (len / 2) && i < joydev->nkey; i++) {
486 if (keypam[i] > KEY_MAX || keypam[i] < BTN_MISC) {
487 retval = -EINVAL;
488 goto out;
489 }
490 }
491
492 memcpy(joydev->keypam, keypam, len);
493
494 for (i = 0; i < joydev->nkey; i++)
495 joydev->keymap[keypam[i] - BTN_MISC] = i;
496
497 out:
498 kfree(keypam);
499 return retval;
500 }
501
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 16396 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Dan Carpenter <error27@gmail.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>
Subject: [linux-stable-rc:linux-4.4.y 1449/1774] drivers/input/joydev.c:485:16: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int'
Date: Mon, 19 Jul 2021 11:39:16 +0800 [thread overview]
Message-ID: <202107191112.AwqoFW63-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 4168 bytes --]
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: h8300-randconfig-r031-20210718 (attached as .config)
compiler: h8300-linux-gcc (GCC) 10.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-10.3.0 make.cross ARCH=h8300
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 >>):
In file included from arch/h8300/include/generated/asm/uaccess.h:1,
from include/linux/poll.h:11,
from drivers/input/joydev.c:27:
include/asm-generic/uaccess.h: In function '__put_user_fn':
include/asm-generic/uaccess.h:178:16: warning: operand of '?:' changes signedness from 'int' to 'size_t' {aka 'long unsigned int'} due to unsignedness of other operand [-Wsign-compare]
178 | return size ? -EFAULT : size;
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 '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 +485 drivers/input/joydev.c
467
468 static int joydev_handle_JSIOCSBTNMAP(struct joydev *joydev,
469 void __user *argp, size_t len)
470 {
471 __u16 *keypam;
472 int i;
473 int retval = 0;
474
475 if (len % sizeof(*keypam))
476 return -EINVAL;
477
478 len = min(len, sizeof(joydev->keypam));
479
480 /* Validate the map. */
481 keypam = memdup_user(argp, len);
482 if (IS_ERR(keypam))
483 return PTR_ERR(keypam);
484
> 485 for (i = 0; i < (len / 2) && i < joydev->nkey; i++) {
486 if (keypam[i] > KEY_MAX || keypam[i] < BTN_MISC) {
487 retval = -EINVAL;
488 goto out;
489 }
490 }
491
492 memcpy(joydev->keypam, keypam, len);
493
494 for (i = 0; i < joydev->nkey; i++)
495 joydev->keymap[keypam[i] - BTN_MISC] = i;
496
497 out:
498 kfree(keypam);
499 return retval;
500 }
501
---
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: 16396 bytes --]
next reply other threads:[~2021-07-19 3:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-19 3:39 kernel test robot [this message]
2021-07-19 3:39 ` [linux-stable-rc:linux-4.4.y 1449/1774] drivers/input/joydev.c:485:16: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' kernel test robot
2021-07-19 7:17 ` Dan Carpenter
2021-07-19 7:17 ` Dan Carpenter
2021-07-19 8:46 ` Rong Chen
2021-07-19 8:46 ` [kbuild-all] " Rong Chen
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=202107191112.AwqoFW63-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.