Commit 39ae691d authored by Stephen Hemminger's avatar Stephen Hemminger

[BLUETOOTH]: Use size_t for size in {send,recv}msg.

parent c97ddec1
...@@ -129,7 +129,7 @@ int bt_sock_unregister(int proto); ...@@ -129,7 +129,7 @@ int bt_sock_unregister(int proto);
struct sock *bt_sock_alloc(struct socket *sock, int proto, int pi_size, int prio); struct sock *bt_sock_alloc(struct socket *sock, int proto, int pi_size, int prio);
void bt_sock_link(struct bt_sock_list *l, struct sock *s); void bt_sock_link(struct bt_sock_list *l, struct sock *s);
void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); void bt_sock_unlink(struct bt_sock_list *l, struct sock *s);
int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, int len, int flags); int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags);
uint bt_sock_poll(struct file * file, struct socket *sock, poll_table *wait); uint bt_sock_poll(struct file * file, struct socket *sock, poll_table *wait);
int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo); int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo);
......
...@@ -201,12 +201,13 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock) ...@@ -201,12 +201,13 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock)
} }
int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len, int flags) struct msghdr *msg, size_t len, int flags)
{ {
int noblock = flags & MSG_DONTWAIT; int noblock = flags & MSG_DONTWAIT;
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct sk_buff *skb; struct sk_buff *skb;
int copied, err; size_t copied;
int err;
BT_DBG("sock %p sk %p len %d", sock, sk, len); BT_DBG("sock %p sk %p len %d", sock, sk, len);
......
...@@ -319,7 +319,8 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_ ...@@ -319,7 +319,8 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_
put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(skb->stamp), &skb->stamp); put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(skb->stamp), &skb->stamp);
} }
static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, int len, int flags) static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t len, int flags)
{ {
int noblock = flags & MSG_DONTWAIT; int noblock = flags & MSG_DONTWAIT;
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
...@@ -355,7 +356,8 @@ static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msgh ...@@ -355,7 +356,8 @@ static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msgh
return err ? : copied; return err ? : copied;
} }
static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, int len) static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t len)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct hci_dev *hdev; struct hci_dev *hdev;
...@@ -370,9 +372,9 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh ...@@ -370,9 +372,9 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh
if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_NOSIGNAL|MSG_ERRQUEUE)) if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_NOSIGNAL|MSG_ERRQUEUE))
return -EINVAL; return -EINVAL;
if (len < 4) if (len < 4 || len > HCI_MAX_FRAME_SIZE)
return -EINVAL; return -EINVAL;
lock_sock(sk); lock_sock(sk);
if (!(hdev = hci_pi(sk)->hdev)) { if (!(hdev = hci_pi(sk)->hdev)) {
......
...@@ -706,7 +706,8 @@ static inline int l2cap_do_send(struct sock *sk, struct msghdr *msg, int len) ...@@ -706,7 +706,8 @@ static inline int l2cap_do_send(struct sock *sk, struct msghdr *msg, int len)
return err; return err;
} }
static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, int len) static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t len)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
int err = 0; int err = 0;
......
...@@ -482,12 +482,12 @@ static int rfcomm_sock_getname(struct socket *sock, struct sockaddr *addr, int * ...@@ -482,12 +482,12 @@ static int rfcomm_sock_getname(struct socket *sock, struct sockaddr *addr, int *
} }
static int rfcomm_sock_sendmsg(struct kiocb *iocb, struct socket *sock, static int rfcomm_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len) struct msghdr *msg, size_t len)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct rfcomm_dlc *d = rfcomm_pi(sk)->dlc; struct rfcomm_dlc *d = rfcomm_pi(sk)->dlc;
struct sk_buff *skb; struct sk_buff *skb;
int err, size; int err;
int sent = 0; int sent = 0;
if (msg->msg_flags & MSG_OOB) if (msg->msg_flags & MSG_OOB)
...@@ -501,7 +501,7 @@ static int rfcomm_sock_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -501,7 +501,7 @@ static int rfcomm_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
lock_sock(sk); lock_sock(sk);
while (len) { while (len) {
size = min_t(uint, len, d->mtu); size_t size = min(len, d->mtu);
skb = sock_alloc_send_skb(sk, size + RFCOMM_SKB_RESERVE, skb = sock_alloc_send_skb(sk, size + RFCOMM_SKB_RESERVE,
msg->msg_flags & MSG_DONTWAIT, &err); msg->msg_flags & MSG_DONTWAIT, &err);
...@@ -556,10 +556,11 @@ static long rfcomm_sock_data_wait(struct sock *sk, long timeo) ...@@ -556,10 +556,11 @@ static long rfcomm_sock_data_wait(struct sock *sk, long timeo)
} }
static int rfcomm_sock_recvmsg(struct kiocb *iocb, struct socket *sock, static int rfcomm_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int size, int flags) struct msghdr *msg, size_t size, int flags)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
int target, err = 0, copied = 0; int err = 0;
size_t target, copied = 0;
long timeo; long timeo;
if (flags & MSG_OOB) if (flags & MSG_OOB)
......
...@@ -630,7 +630,8 @@ static int sco_sock_getname(struct socket *sock, struct sockaddr *addr, int *len ...@@ -630,7 +630,8 @@ static int sco_sock_getname(struct socket *sock, struct sockaddr *addr, int *len
return 0; return 0;
} }
static int sco_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, int len) static int sco_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, size_t len)
{ {
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
int err = 0; int err = 0;
......
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