[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1654660177-115463-1-git-send-email-mikelley@microsoft.com>
Date: Tue, 7 Jun 2022 20:49:37 -0700
From: Michael Kelley <mikelley@...rosoft.com>
To: sthemmin@...rosoft.com, kys@...rosoft.com, wei.liu@...nel.org,
decui@...rosoft.com, haiyangz@...rosoft.com, jikos@...nel.org,
benjamin.tissoires@...hat.com, linux-kernel@...r.kernel.org,
linux-hyperv@...r.kernel.org, linux-input@...r.kernel.org
Cc: mikelley@...rosoft.com
Subject: [PATCH 1/1] 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@...el.com>
Signed-off-by: Michael Kelley <mikelley@...rosoft.com>
---
drivers/hid/hid-hyperv.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c
index 978ee2a..e0bc731 100644
--- a/drivers/hid/hid-hyperv.c
+++ b/drivers/hid/hid-hyperv.c
@@ -199,7 +199,8 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
if (!input_device->hid_desc)
goto cleanup;
- input_device->report_desc_size = desc->desc[0].wDescriptorLength;
+ input_device->report_desc_size = le16_to_cpu(
+ desc->desc[0].wDescriptorLength);
if (input_device->report_desc_size == 0) {
input_device->dev_info_status = -EINVAL;
goto cleanup;
@@ -217,7 +218,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
memcpy(input_device->report_desc,
((unsigned char *)desc) + desc->bLength,
- desc->desc[0].wDescriptorLength);
+ le16_to_cpu(desc->desc[0].wDescriptorLength));
/* Send the ack */
memset(&ack, 0, sizeof(struct mousevsc_prt_msg));
--
1.8.3.1
Powered by blists - more mailing lists