From: Stephen Hemminger <shemminger@osdl.org>
To: "David S. Miller" <davem@redhat.com>, Ralf Baechle <ralf@linux-mips.org>
Cc: netdev@oss.sgi.com
Subject: [PATCH] (7/15) ax25 - size_t in send/recvmsg
Date: Fri, 9 Jan 2004 13:48:15 -0800 [thread overview]
Message-ID: <20040109134815.09ef4df0@linux.local> (raw)
Convert Amateur Radio X.25 to unsigned size for send/receive.
Also enforce an MTU here, since there is no fragmentation logic.
diff -Nru a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
--- a/net/ax25/af_ax25.c Mon Dec 8 16:19:49 2003
+++ b/net/ax25/af_ax25.c Mon Dec 8 16:19:49 2003
@@ -1415,7 +1415,7 @@
}
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 sock *sk = sock->sk;
@@ -1424,7 +1424,8 @@
ax25_digi dtmp, *dp;
unsigned char *asmptr;
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)) {
return -EINVAL;
@@ -1449,6 +1450,11 @@
goto out;
}
+ if (len > ax25->ax25_dev->dev->mtu) {
+ err = -EMSGSIZE;
+ goto out;
+ }
+
if (usax != NULL) {
if (usax->sax25_family != AF_AX25) {
err = -EINVAL;
@@ -1594,7 +1600,7 @@
}
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 sk_buff *skb;
reply other threads:[~2004-01-09 21:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040109134815.09ef4df0@linux.local \
--to=shemminger@osdl.org \
--cc=davem@redhat.com \
--cc=netdev@oss.sgi.com \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).