Commit 96b8f9e5 authored by Maksim Krasnyanskiy's avatar Maksim Krasnyanskiy

Fix hci_get_dev_list() for big endian machines.

It has to use sizeof() of the actual structure instead of
sizeof(__u16).
parent c1a988bb
...@@ -718,7 +718,7 @@ int hci_get_dev_list(unsigned long arg) ...@@ -718,7 +718,7 @@ int hci_get_dev_list(unsigned long arg)
if (!dev_num) if (!dev_num)
return -EINVAL; return -EINVAL;
size = dev_num * sizeof(struct hci_dev_req) + sizeof(__u16); size = dev_num * sizeof(*dr) + sizeof(*dl);
if (verify_area(VERIFY_WRITE, (void *) arg, size)) if (verify_area(VERIFY_WRITE, (void *) arg, size))
return -EFAULT; return -EFAULT;
...@@ -739,7 +739,7 @@ int hci_get_dev_list(unsigned long arg) ...@@ -739,7 +739,7 @@ int hci_get_dev_list(unsigned long arg)
read_unlock_bh(&hci_dev_list_lock); read_unlock_bh(&hci_dev_list_lock);
dl->dev_num = n; dl->dev_num = n;
size = n * sizeof(struct hci_dev_req) + sizeof(__u16); size = n * sizeof(*dr) + sizeof(*dl);
copy_to_user((void *) arg, dl, size); copy_to_user((void *) arg, dl, size);
kfree(dl); kfree(dl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment