Skip to content

Commit f5f93d7

Browse files
kelleymhliuw
authored andcommitted
HID: hyperv: Correctly access fields declared as __le16
Add the use of le16_to_cpu() for fields declared as __le16. Because Hyper-V only runs in Little Endian mode, there's no actual bug. The change is made in the interest of general correctness in addition to making sparse happy. No functional change. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/1654660177-115463-1-git-send-email-mikelley@microsoft.com Signed-off-by: Wei Liu <wei.liu@kernel.org>
1 parent 245b993 commit f5f93d7

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/hid/hid-hyperv.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
199199
if (!input_device->hid_desc)
200200
goto cleanup;
201201

202-
input_device->report_desc_size = desc->desc[0].wDescriptorLength;
202+
input_device->report_desc_size = le16_to_cpu(
203+
desc->desc[0].wDescriptorLength);
203204
if (input_device->report_desc_size == 0) {
204205
input_device->dev_info_status = -EINVAL;
205206
goto cleanup;
@@ -217,7 +218,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
217218

218219
memcpy(input_device->report_desc,
219220
((unsigned char *)desc) + desc->bLength,
220-
desc->desc[0].wDescriptorLength);
221+
le16_to_cpu(desc->desc[0].wDescriptorLength));
221222

222223
/* Send the ack */
223224
memset(&ack, 0, sizeof(struct mousevsc_prt_msg));

0 commit comments

Comments
 (0)