提交 52e0b011 编写于 作者: G Gustavo Padovan

Bluetooth: Fix uuid output in debugfs

The uuid should be printed in the CPU endianness and not in little-endian.
Acked-by: NJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
上级 a1d70450
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/module.h> #include <linux/module.h>
#include <asm/unaligned.h>
#include <net/bluetooth/bluetooth.h> #include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h> #include <net/bluetooth/hci_core.h>
...@@ -461,19 +462,18 @@ static const struct file_operations blacklist_fops = { ...@@ -461,19 +462,18 @@ static const struct file_operations blacklist_fops = {
static void print_bt_uuid(struct seq_file *f, u8 *uuid) static void print_bt_uuid(struct seq_file *f, u8 *uuid)
{ {
__be32 data0, data4; u32 data0, data5;
__be16 data1, data2, data3, data5; u16 data1, data2, data3, data4;
memcpy(&data0, &uuid[0], 4); data5 = get_unaligned_le32(uuid);
memcpy(&data1, &uuid[4], 2); data4 = get_unaligned_le16(uuid + 4);
memcpy(&data2, &uuid[6], 2); data3 = get_unaligned_le16(uuid + 6);
memcpy(&data3, &uuid[8], 2); data2 = get_unaligned_le16(uuid + 8);
memcpy(&data4, &uuid[10], 4); data1 = get_unaligned_le16(uuid + 10);
memcpy(&data5, &uuid[14], 2); data0 = get_unaligned_le32(uuid + 12);
seq_printf(f, "%.8x-%.4x-%.4x-%.4x-%.8x%.4x\n", seq_printf(f, "%.8x-%.4x-%.4x-%.4x-%.4x%.8x\n",
ntohl(data0), ntohs(data1), ntohs(data2), ntohs(data3), data0, data1, data2, data3, data4, data5);
ntohl(data4), ntohs(data5));
} }
static int uuids_show(struct seq_file *f, void *p) static int uuids_show(struct seq_file *f, void *p)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册