[linux-next:master 8744/9027] drivers/hid/bpf/hid_bpf_dispatch.c:363:47: 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: i386-allmodconfig (https://download.01.org/0day-ci/archive/20240628/202406282304.UydSVncq-lkp@xxxxxxxxx/config)
compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240628/202406282304.UydSVncq-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/202406282304.UydSVncq-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   drivers/hid/bpf/hid_bpf_dispatch.c: In function 'hid_bpf_hw_request':
>> drivers/hid/bpf/hid_bpf_dispatch.c:363:47: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     363 |                                               (__u64)ctx);
         |                                               ^
   drivers/hid/bpf/hid_bpf_dispatch.c: In function 'hid_bpf_hw_output_report':
   drivers/hid/bpf/hid_bpf_dispatch.c:403:49: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     403 |                                                 (__u64)ctx);
         |                                                 ^
   drivers/hid/bpf/hid_bpf_dispatch.c: In function 'hid_bpf_input_report':
   drivers/hid/bpf/hid_bpf_dispatch.c:434:68: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     434 |         return hid_ops->hid_input_report(hdev, type, buf, size, 0, (__u64)ctx);
         |                                                                    ^


vim +363 drivers/hid/bpf/hid_bpf_dispatch.c

   313	
   314	/**
   315	 * hid_bpf_hw_request - Communicate with a HID device
   316	 *
   317	 * @ctx: the HID-BPF context previously allocated in hid_bpf_allocate_context()
   318	 * @buf: a %PTR_TO_MEM buffer
   319	 * @buf__sz: the size of the data to transfer
   320	 * @rtype: the type of the report (%HID_INPUT_REPORT, %HID_FEATURE_REPORT, %HID_OUTPUT_REPORT)
   321	 * @reqtype: the type of the request (%HID_REQ_GET_REPORT, %HID_REQ_SET_REPORT, ...)
   322	 *
   323	 * @returns %0 on success, a negative error code otherwise.
   324	 */
   325	__bpf_kfunc int
   326	hid_bpf_hw_request(struct hid_bpf_ctx *ctx, __u8 *buf, size_t buf__sz,
   327			   enum hid_report_type rtype, enum hid_class_request reqtype)
   328	{
   329		struct hid_device *hdev;
   330		size_t size = buf__sz;
   331		u8 *dma_data;
   332		int ret;
   333	
   334		/* check arguments */
   335		ret = __hid_bpf_hw_check_params(ctx, buf, &size, rtype);
   336		if (ret)
   337			return ret;
   338	
   339		switch (reqtype) {
   340		case HID_REQ_GET_REPORT:
   341		case HID_REQ_GET_IDLE:
   342		case HID_REQ_GET_PROTOCOL:
   343		case HID_REQ_SET_REPORT:
   344		case HID_REQ_SET_IDLE:
   345		case HID_REQ_SET_PROTOCOL:
   346			break;
   347		default:
   348			return -EINVAL;
   349		}
   350	
   351		hdev = (struct hid_device *)ctx->hid; /* discard const */
   352	
   353		dma_data = kmemdup(buf, size, GFP_KERNEL);
   354		if (!dma_data)
   355			return -ENOMEM;
   356	
   357		ret = hid_ops->hid_hw_raw_request(hdev,
   358						      dma_data[0],
   359						      dma_data,
   360						      size,
   361						      rtype,
   362						      reqtype,
 > 363						      (__u64)ctx);
   364	
   365		if (ret > 0)
   366			memcpy(buf, dma_data, ret);
   367	
   368		kfree(dma_data);
   369		return ret;
   370	}
   371	

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