* [PATCH] HID: surface-hid: Fix integer endian conversion
@ 2021-04-11 11:34 Maximilian Luz
2021-04-30 18:01 ` Maximilian Luz
2021-05-05 12:32 ` Jiri Kosina
0 siblings, 2 replies; 3+ messages in thread
From: Maximilian Luz @ 2021-04-11 11:34 UTC (permalink / raw)
To: Jiri Kosina
Cc: Maximilian Luz, Benjamin Tissoires, linux-input, linux-kernel,
kernel test robot
We want to convert from 16 bit (unsigned) little endian values contained
in a packed struct to CPU native endian values here, not the other way
around. So replace cpu_to_le16() with get_unaligned_le16(), using the
latter instead of le16_to_cpu() to acknowledge that we are reading from
a packed struct.
Reported-by: kernel test robot <lkp@intel.com>
Fixes: b05ff1002a5c ("HID: Add support for Surface Aggregator Module HID transport")
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
---
drivers/hid/surface-hid/surface_hid_core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/hid/surface-hid/surface_hid_core.c b/drivers/hid/surface-hid/surface_hid_core.c
index 7b27ec392232..5571e74abe91 100644
--- a/drivers/hid/surface-hid/surface_hid_core.c
+++ b/drivers/hid/surface-hid/surface_hid_core.c
@@ -168,9 +168,9 @@ int surface_hid_device_add(struct surface_hid_device *shid)
shid->hid->dev.parent = shid->dev;
shid->hid->bus = BUS_HOST;
- shid->hid->vendor = cpu_to_le16(shid->attrs.vendor);
- shid->hid->product = cpu_to_le16(shid->attrs.product);
- shid->hid->version = cpu_to_le16(shid->hid_desc.hid_version);
+ shid->hid->vendor = get_unaligned_le16(&shid->attrs.vendor);
+ shid->hid->product = get_unaligned_le16(&shid->attrs.product);
+ shid->hid->version = get_unaligned_le16(&shid->hid_desc.hid_version);
shid->hid->country = shid->hid_desc.country_code;
snprintf(shid->hid->name, sizeof(shid->hid->name), "Microsoft Surface %04X:%04X",
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] HID: surface-hid: Fix integer endian conversion
2021-04-11 11:34 [PATCH] HID: surface-hid: Fix integer endian conversion Maximilian Luz
@ 2021-04-30 18:01 ` Maximilian Luz
2021-05-05 12:32 ` Jiri Kosina
1 sibling, 0 replies; 3+ messages in thread
From: Maximilian Luz @ 2021-04-30 18:01 UTC (permalink / raw)
To: Jiri Kosina
Cc: Benjamin Tissoires, linux-input, linux-kernel, kernel test robot
On 4/11/21 1:34 PM, Maximilian Luz wrote:
> We want to convert from 16 bit (unsigned) little endian values contained
> in a packed struct to CPU native endian values here, not the other way
> around. So replace cpu_to_le16() with get_unaligned_le16(), using the
> latter instead of le16_to_cpu() to acknowledge that we are reading from
> a packed struct.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Fixes: b05ff1002a5c ("HID: Add support for Surface Aggregator Module HID transport")
> Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Friendly ping as it seems this hasn't made it into the PR for v5.13 :)
Regards,
Max
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] HID: surface-hid: Fix integer endian conversion
2021-04-11 11:34 [PATCH] HID: surface-hid: Fix integer endian conversion Maximilian Luz
2021-04-30 18:01 ` Maximilian Luz
@ 2021-05-05 12:32 ` Jiri Kosina
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2021-05-05 12:32 UTC (permalink / raw)
To: Maximilian Luz
Cc: Benjamin Tissoires, linux-input, linux-kernel, kernel test robot
On Sun, 11 Apr 2021, Maximilian Luz wrote:
> We want to convert from 16 bit (unsigned) little endian values contained
> in a packed struct to CPU native endian values here, not the other way
> around. So replace cpu_to_le16() with get_unaligned_le16(), using the
> latter instead of le16_to_cpu() to acknowledge that we are reading from
> a packed struct.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Fixes: b05ff1002a5c ("HID: Add support for Surface Aggregator Module HID transport")
> Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Applied to hid.git#for-5.13/upstream-fixes. Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-05 12:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-11 11:34 [PATCH] HID: surface-hid: Fix integer endian conversion Maximilian Luz
2021-04-30 18:01 ` Maximilian Luz
2021-05-05 12:32 ` Jiri Kosina
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).