[linux-next:master 8744/9027] drivers/hid/hidraw.c:143:63: warning: cast from pointer to integer of different size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   642a16ca7994a50d7de85715996a8ce171a5bdfb
commit: 67eccf151d76a9939ad8a50c6db5cb486b01df24 [8744/9027] HID: add source argument to HID low level functions
config: sh-buildonly-randconfig-r004-20220419 (https://download.01.org/0day-ci/archive/20240628/202406280633.OPB5uIFj-lkp@xxxxxxxxx/config)
compiler: sh4-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240628/202406280633.OPB5uIFj-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406280633.OPB5uIFj-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   drivers/hid/hidraw.c: In function 'hidraw_send_report':
>> drivers/hid/hidraw.c:143:63: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     143 |                 ret = __hid_hw_output_report(dev, buf, count, (__u64)file);
         |                                                               ^
   drivers/hid/hidraw.c:154:56: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     154 |                                    HID_REQ_SET_REPORT, (__u64)file);
         |                                                        ^
   drivers/hid/hidraw.c: In function 'hidraw_get_report':
   drivers/hid/hidraw.c:231:56: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     231 |                                    HID_REQ_GET_REPORT, (__u64)file);
         |                                                        ^


vim +143 drivers/hid/hidraw.c

   101	
   102	/*
   103	 * The first byte of the report buffer is expected to be a report number.
   104	 */
   105	static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, size_t count, unsigned char report_type)
   106	{
   107		unsigned int minor = iminor(file_inode(file));
   108		struct hid_device *dev;
   109		__u8 *buf;
   110		int ret = 0;
   111	
   112		lockdep_assert_held(&minors_rwsem);
   113	
   114		if (!hidraw_table[minor] || !hidraw_table[minor]->exist) {
   115			ret = -ENODEV;
   116			goto out;
   117		}
   118	
   119		dev = hidraw_table[minor]->hid;
   120	
   121		if (count > HID_MAX_BUFFER_SIZE) {
   122			hid_warn(dev, "pid %d passed too large report\n",
   123				 task_pid_nr(current));
   124			ret = -EINVAL;
   125			goto out;
   126		}
   127	
   128		if (count < 2) {
   129			hid_warn(dev, "pid %d passed too short report\n",
   130				 task_pid_nr(current));
   131			ret = -EINVAL;
   132			goto out;
   133		}
   134	
   135		buf = memdup_user(buffer, count);
   136		if (IS_ERR(buf)) {
   137			ret = PTR_ERR(buf);
   138			goto out;
   139		}
   140	
   141		if ((report_type == HID_OUTPUT_REPORT) &&
   142		    !(dev->quirks & HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP)) {
 > 143			ret = __hid_hw_output_report(dev, buf, count, (__u64)file);
   144			/*
   145			 * compatibility with old implementation of USB-HID and I2C-HID:
   146			 * if the device does not support receiving output reports,
   147			 * on an interrupt endpoint, fallback to SET_REPORT HID command.
   148			 */
   149			if (ret != -ENOSYS)
   150				goto out_free;
   151		}
   152	
   153		ret = __hid_hw_raw_request(dev, buf[0], buf, count, report_type,
   154					   HID_REQ_SET_REPORT, (__u64)file);
   155	
   156	out_free:
   157		kfree(buf);
   158	out:
   159		return ret;
   160	}
   161	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux