From 5831945d3ee2eb6d6bc153fe29fda610589d3d10 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 8 Jan 2004 09:53:49 -0800 Subject: [PATCH] [IPX]: Use size_t for size in {send,recv}msg. --- net/ipx/af_ipx.c | 8 ++++++-- net/ipx/ipx_route.c | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index 0b706f561bf38..ed0f252c8faf1 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c @@ -1683,7 +1683,7 @@ out: } static int ipx_sendmsg(struct kiocb *iocb, struct socket *sock, - struct msghdr *msg, int len) + struct msghdr *msg, size_t len) { struct sock *sk = sock->sk; struct ipx_opt *ipxs = ipx_sk(sk); @@ -1698,6 +1698,10 @@ static int ipx_sendmsg(struct kiocb *iocb, struct socket *sock, if (flags & ~MSG_DONTWAIT) goto out; + /* Max possible packet size limited by 16 bit pktsize in header */ + if (len >= 65535 - sizeof(struct ipxhdr)) + goto out; + if (usipx) { if (!ipxs->port) { struct sockaddr_ipx uaddr; @@ -1744,7 +1748,7 @@ out: static int ipx_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 ipx_opt *ipxs = ipx_sk(sk); diff --git a/net/ipx/ipx_route.c b/net/ipx/ipx_route.c index 415554af8f3b4..63505106ee5b1 100644 --- a/net/ipx/ipx_route.c +++ b/net/ipx/ipx_route.c @@ -169,13 +169,13 @@ int ipxrtr_route_skb(struct sk_buff *skb) * Route an outgoing frame from a socket. */ int ipxrtr_route_packet(struct sock *sk, struct sockaddr_ipx *usipx, - struct iovec *iov, int len, int noblock) + struct iovec *iov, size_t len, int noblock) { struct sk_buff *skb; struct ipx_opt *ipxs = ipx_sk(sk); struct ipx_interface *intrfc; struct ipxhdr *ipx; - int size; + size_t size; int ipx_offset; struct ipx_route *rt = NULL; int rc; -- 2.53.0