linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] HID: hyperv: Correctly access fields declared as __le16
@ 2022-06-08  3:49 Michael Kelley
  2022-06-08 12:28 ` Wei Liu
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Kelley @ 2022-06-08  3:49 UTC (permalink / raw)
  To: sthemmin, kys, wei.liu, decui, haiyangz, jikos,
	benjamin.tissoires, linux-kernel, linux-hyperv, linux-input
  Cc: mikelley

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] HID: hyperv: Correctly access fields declared as __le16
  2022-06-08  3:49 [PATCH 1/1] HID: hyperv: Correctly access fields declared as __le16 Michael Kelley
@ 2022-06-08 12:28 ` Wei Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Wei Liu @ 2022-06-08 12:28 UTC (permalink / raw)
  To: Michael Kelley
  Cc: sthemmin, kys, wei.liu, decui, haiyangz, jikos,
	benjamin.tissoires, linux-kernel, linux-hyperv, linux-input

On Tue, Jun 07, 2022 at 08:49:37PM -0700, Michael Kelley wrote:
> 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>

Applied to hyperv-fixes. Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-08 12:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-08  3:49 [PATCH 1/1] HID: hyperv: Correctly access fields declared as __le16 Michael Kelley
2022-06-08 12:28 ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).