mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: hci_ll: Add endianness conversion when setting baudrate
@ 2017-12-08  2:22 David Lechner
  2017-12-08  8:00 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: David Lechner @ 2017-12-08  2:22 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: David Lechner, Marcel Holtmann, Gustavo Padovan, Johan Hedberg,
	linux-kernel

This adds an endianness conversion when setting the baudrate using a
vendor-specific command. Otherwise, bad things might happen on a big-
endian system.

Suggested-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: David Lechner <david@lechnology.com>
---
 drivers/bluetooth/hci_ll.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c
index 944cdd2..486b4ea 100644
--- a/drivers/bluetooth/hci_ll.c
+++ b/drivers/bluetooth/hci_ll.c
@@ -739,10 +739,12 @@ static int ll_setup(struct hci_uart *hu)
 		speed = 0;
 
 	if (speed) {
+		__le32 speed_le = cpu_to_le32(speed);
 		struct sk_buff *skb;
 
 		skb = __hci_cmd_sync(hu->hdev, HCI_VS_UPDATE_UART_HCI_BAUDRATE,
-				     sizeof(speed), &speed, HCI_INIT_TIMEOUT);
+				     sizeof(speed_le), &speed_le,
+				     HCI_INIT_TIMEOUT);
 		if (!IS_ERR(skb)) {
 			kfree_skb(skb);
 			serdev_device_set_baudrate(serdev, speed);
-- 
2.7.4

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

* Re: [PATCH] Bluetooth: hci_ll: Add endianness conversion when setting baudrate
  2017-12-08  2:22 [PATCH] Bluetooth: hci_ll: Add endianness conversion when setting baudrate David Lechner
@ 2017-12-08  8:00 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2017-12-08  8:00 UTC (permalink / raw)
  To: David Lechner
  Cc: open list:BLUETOOTH DRIVERS, Gustavo F. Padovan, Johan Hedberg,
	linux-kernel

Hi David,

> This adds an endianness conversion when setting the baudrate using a
> vendor-specific command. Otherwise, bad things might happen on a big-
> endian system.
> 
> Suggested-by: Marcel Holtmann <marcel@holtmann.org>
> Signed-off-by: David Lechner <david@lechnology.com>
> ---
> drivers/bluetooth/hci_ll.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel

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

end of thread, other threads:[~2017-12-08  8:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-08  2:22 [PATCH] Bluetooth: hci_ll: Add endianness conversion when setting baudrate David Lechner
2017-12-08  8:00 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®