Commit 89aebaff authored by Stephen Hemminger's avatar Stephen Hemminger

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

parent df5b6439
...@@ -1401,7 +1401,7 @@ static int ax25_getname(struct socket *sock, struct sockaddr *uaddr, ...@@ -1401,7 +1401,7 @@ static int ax25_getname(struct socket *sock, struct sockaddr *uaddr,
} }
static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock, static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
struct msghdr *msg, int len) struct msghdr *msg, size_t len)
{ {
struct sockaddr_ax25 *usax = (struct sockaddr_ax25 *)msg->msg_name; struct sockaddr_ax25 *usax = (struct sockaddr_ax25 *)msg->msg_name;
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
...@@ -1410,7 +1410,8 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1410,7 +1410,8 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
ax25_digi dtmp, *dp; ax25_digi dtmp, *dp;
unsigned char *asmptr; unsigned char *asmptr;
ax25_cb *ax25; ax25_cb *ax25;
int lv, size, err, addr_len = msg->msg_namelen; size_t size;
int lv, err, addr_len = msg->msg_namelen;
if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR)) { if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR)) {
return -EINVAL; return -EINVAL;
...@@ -1435,6 +1436,11 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1435,6 +1436,11 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
goto out; goto out;
} }
if (len > ax25->ax25_dev->dev->mtu) {
err = -EMSGSIZE;
goto out;
}
if (usax != NULL) { if (usax != NULL) {
if (usax->sax25_family != AF_AX25) { if (usax->sax25_family != AF_AX25) {
err = -EINVAL; err = -EINVAL;
...@@ -1580,7 +1586,7 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1580,7 +1586,7 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
} }
static int ax25_recvmsg(struct kiocb *iocb, struct socket *sock, static int ax25_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;
struct sk_buff *skb; struct sk_buff *skb;
......
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