[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202111192231.ekCAJ0Sp-lkp@intel.com>
Date: Fri, 19 Nov 2021 22:54:44 +0800
From: kernel test robot <lkp@...el.com>
To: Michael Kelley <mikelley@...rosoft.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Wei Liu <wei.liu@...nel.org>, Boqun Feng <boqun.feng@...il.com>
Subject: drivers/hid/hid-hyperv.c:218:9: sparse: sparse: incorrect type in
argument 3 (different base types)
Hi Michael,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4c388a8e740d3235a194f330c8ef327deef710f6
commit: 7aff79e297ee1aa0126924921fd87a4ae59d2467 Drivers: hv: Enable Hyper-V code to be built on ARM64
date: 4 months ago
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7aff79e297ee1aa0126924921fd87a4ae59d2467
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 7aff79e297ee1aa0126924921fd87a4ae59d2467
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
drivers/hid/hid-hyperv.c:202:40: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] report_desc_size @@ got restricted __le16 [usertype] wDescriptorLength @@
drivers/hid/hid-hyperv.c:202:40: sparse: expected unsigned int [usertype] report_desc_size
drivers/hid/hid-hyperv.c:202:40: sparse: got restricted __le16 [usertype] wDescriptorLength
>> drivers/hid/hid-hyperv.c:218:9: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned long [usertype] @@ got restricted __le16 [usertype] wDescriptorLength @@
drivers/hid/hid-hyperv.c:218:9: sparse: expected unsigned long [usertype]
drivers/hid/hid-hyperv.c:218:9: sparse: got restricted __le16 [usertype] wDescriptorLength
vim +218 drivers/hid/hid-hyperv.c
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 180
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 181 static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 182 struct synthhid_device_info *device_info)
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 183 {
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 184 int ret = 0;
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 185 struct hid_descriptor *desc;
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 186 struct mousevsc_prt_msg ack;
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 187
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 188 input_device->dev_info_status = -ENOMEM;
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 189
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 190 input_device->hid_dev_info = device_info->hid_dev_info;
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 191 desc = &device_info->hid_descriptor;
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 192 if (desc->bLength == 0)
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 193 goto cleanup;
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 194
af13f9ed6f9aa68 Dexuan Cui 2019-11-19 195 /* The pointer is not NULL when we resume from hibernation */
af13f9ed6f9aa68 Dexuan Cui 2019-11-19 196 kfree(input_device->hid_desc);
a4a23f6d68ad2c8 Thomas Meyer 2013-06-01 197 input_device->hid_desc = kmemdup(desc, desc->bLength, GFP_ATOMIC);
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 198
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 199 if (!input_device->hid_desc)
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 200 goto cleanup;
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 201
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 202 input_device->report_desc_size = desc->desc[0].wDescriptorLength;
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 203 if (input_device->report_desc_size == 0) {
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 204 input_device->dev_info_status = -EINVAL;
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 205 goto cleanup;
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 206 }
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 207
af13f9ed6f9aa68 Dexuan Cui 2019-11-19 208 /* The pointer is not NULL when we resume from hibernation */
af13f9ed6f9aa68 Dexuan Cui 2019-11-19 209 kfree(input_device->report_desc);
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 210 input_device->report_desc = kzalloc(input_device->report_desc_size,
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 211 GFP_ATOMIC);
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 212
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 213 if (!input_device->report_desc) {
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 214 input_device->dev_info_status = -ENOMEM;
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 215 goto cleanup;
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 216 }
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 217
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 @218 memcpy(input_device->report_desc,
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 219 ((unsigned char *)desc) + desc->bLength,
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 220 desc->desc[0].wDescriptorLength);
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 221
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 222 /* Send the ack */
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 223 memset(&ack, 0, sizeof(struct mousevsc_prt_msg));
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 224
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 225 ack.type = PIPE_MESSAGE_DATA;
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 226 ack.size = sizeof(struct synthhid_device_info_ack);
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 227
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 228 ack.ack.header.type = SYNTH_HID_INITIAL_DEVICE_INFO_ACK;
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 229 ack.ack.header.size = 1;
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 230 ack.ack.reserved = 0;
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 231
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 232 ret = vmbus_sendpacket(input_device->device->channel,
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 233 &ack,
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 234 sizeof(struct pipe_prt_msg) - sizeof(unsigned char) +
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 235 sizeof(struct synthhid_device_info_ack),
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 236 (unsigned long)&ack,
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 237 VM_PKT_DATA_INBAND,
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 238 VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 239
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 240 if (!ret)
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 241 input_device->dev_info_status = 0;
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 242
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 243 cleanup:
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 244 complete(&input_device->wait_event);
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 245
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 246 return;
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 247 }
b95f5bcb811e390 K. Y. Srinivasan 2011-11-17 248
:::::: The code at line 218 was first introduced by commit
:::::: b95f5bcb811e3905b5376f87789da8d097fee682 HID: Move the hid-hyperv driver out of staging
:::::: TO: K. Y. Srinivasan <kys@...rosoft.com>
:::::: CC: Jiri Kosina <jkosina@...e.cz>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (78176 bytes)
Powered by blists - more mailing lists