mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-03-17 12:34:01 +00:00
Bluetooth: hci_sock: fix endian bug in hci_sock_setsockopt()
This copies a u16 into the high bits of an int, which works on a big
endian system but not on a little endian system.
Fixes: 09572fca72
("Bluetooth: hci_sock: Add support for BT_{SND,RCV}BUF")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
2b70d4f9b2
commit
b9f9dbad0b
1 changed files with 3 additions and 2 deletions
|
@ -1911,7 +1911,8 @@ static int hci_sock_setsockopt(struct socket *sock, int level, int optname,
|
|||
sockptr_t optval, unsigned int len)
|
||||
{
|
||||
struct sock *sk = sock->sk;
|
||||
int err = 0, opt = 0;
|
||||
int err = 0;
|
||||
u16 opt;
|
||||
|
||||
BT_DBG("sk %p, opt %d", sk, optname);
|
||||
|
||||
|
@ -1937,7 +1938,7 @@ static int hci_sock_setsockopt(struct socket *sock, int level, int optname,
|
|||
goto done;
|
||||
}
|
||||
|
||||
if (copy_from_sockptr(&opt, optval, sizeof(u16))) {
|
||||
if (copy_from_sockptr(&opt, optval, sizeof(opt))) {
|
||||
err = -EFAULT;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue