Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
c97ddec1
Commit
c97ddec1
authored
Jan 08, 2004
by
Stephen Hemminger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IPV4/IPV6]: Use size_t for size in {send,recv}msg.
parent
a7984945
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
35 additions
and
51 deletions
+35
-51
include/net/inet_common.h
include/net/inet_common.h
+2
-2
include/net/tcp.h
include/net/tcp.h
+2
-2
include/net/udp.h
include/net/udp.h
+1
-1
net/ipv4/af_inet.c
net/ipv4/af_inet.c
+2
-2
net/ipv4/raw.c
net/ipv4/raw.c
+3
-14
net/ipv4/tcp.c
net/ipv4/tcp.c
+2
-2
net/ipv4/udp.c
net/ipv4/udp.c
+3
-14
net/ipv6/raw.c
net/ipv6/raw.c
+6
-3
net/ipv6/udp.c
net/ipv6/udp.c
+7
-4
net/sctp/socket.c
net/sctp/socket.c
+7
-7
No files found.
include/net/inet_common.h
View file @
c97ddec1
...
...
@@ -23,11 +23,11 @@ extern int inet_accept(struct socket *sock,
extern
int
inet_recvmsg
(
struct
kiocb
*
iocb
,
struct
socket
*
sock
,
struct
msghdr
*
ubuf
,
in
t
size
,
int
flags
);
size_
t
size
,
int
flags
);
extern
int
inet_sendmsg
(
struct
kiocb
*
iocb
,
struct
socket
*
sock
,
struct
msghdr
*
msg
,
in
t
size
);
size_
t
size
);
extern
int
inet_shutdown
(
struct
socket
*
sock
,
int
how
);
extern
unsigned
int
inet_poll
(
struct
file
*
file
,
struct
socket
*
sock
,
struct
poll_table_struct
*
wait
);
extern
int
inet_setsockopt
(
struct
socket
*
sock
,
int
level
,
...
...
include/net/tcp.h
View file @
c97ddec1
...
...
@@ -752,7 +752,7 @@ extern int tcp_v4_remember_stamp(struct sock *sk);
extern
int
tcp_v4_tw_remember_stamp
(
struct
tcp_tw_bucket
*
tw
);
extern
int
tcp_sendmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
struct
msghdr
*
msg
,
in
t
size
);
struct
msghdr
*
msg
,
size_
t
size
);
extern
ssize_t
tcp_sendpage
(
struct
socket
*
sock
,
struct
page
*
page
,
int
offset
,
size_t
size
,
int
flags
);
extern
int
tcp_ioctl
(
struct
sock
*
sk
,
...
...
@@ -846,7 +846,7 @@ extern int tcp_setsockopt(struct sock *sk, int level,
extern
void
tcp_set_keepalive
(
struct
sock
*
sk
,
int
val
);
extern
int
tcp_recvmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
struct
msghdr
*
msg
,
in
t
len
,
int
nonblock
,
size_
t
len
,
int
nonblock
,
int
flags
,
int
*
addr_len
);
extern
int
tcp_listen_start
(
struct
sock
*
sk
);
...
...
include/net/udp.h
View file @
c97ddec1
...
...
@@ -68,7 +68,7 @@ extern int udp_connect(struct sock *sk,
struct
sockaddr
*
usin
,
int
addr_len
);
extern
int
udp_sendmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
struct
msghdr
*
msg
,
in
t
len
);
struct
msghdr
*
msg
,
size_
t
len
);
extern
int
udp_rcv
(
struct
sk_buff
*
skb
);
extern
int
udp_ioctl
(
struct
sock
*
sk
,
int
cmd
,
unsigned
long
arg
);
...
...
net/ipv4/af_inet.c
View file @
c97ddec1
...
...
@@ -731,7 +731,7 @@ int inet_getname(struct socket *sock, struct sockaddr *uaddr,
int
inet_recvmsg
(
struct
kiocb
*
iocb
,
struct
socket
*
sock
,
struct
msghdr
*
msg
,
in
t
size
,
int
flags
)
size_
t
size
,
int
flags
)
{
struct
sock
*
sk
=
sock
->
sk
;
int
addr_len
=
0
;
...
...
@@ -746,7 +746,7 @@ int inet_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
int
inet_sendmsg
(
struct
kiocb
*
iocb
,
struct
socket
*
sock
,
struct
msghdr
*
msg
,
in
t
size
)
size_
t
size
)
{
struct
sock
*
sk
=
sock
->
sk
;
...
...
net/ipv4/raw.c
View file @
c97ddec1
...
...
@@ -324,7 +324,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, int length,
}
static
int
raw_sendmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
struct
msghdr
*
msg
,
in
t
len
)
size_
t
len
)
{
struct
inet_opt
*
inet
=
inet_sk
(
sk
);
struct
ipcm_cookie
ipc
;
...
...
@@ -335,17 +335,6 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
u8
tos
;
int
err
;
/* This check is ONLY to check for arithmetic overflow
on integer(!) len. Not more! Real check will be made
in ip_build_xmit --ANK
BTW socket.c -> af_*.c -> ... make multiple
invalid conversions size_t -> int. We MUST repair it f.e.
by replacing all of them with size_t and revise all
the places sort of len += sizeof(struct iphdr)
If len was ULONG_MAX-10 it would be cathastrophe --ANK
*/
err
=
-
EMSGSIZE
;
if
(
len
<
0
||
len
>
0xFFFF
)
goto
out
;
...
...
@@ -523,10 +512,10 @@ out: return ret;
*/
int
raw_recvmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
struct
msghdr
*
msg
,
in
t
len
,
int
noblock
,
int
flags
,
int
*
addr_len
)
size_
t
len
,
int
noblock
,
int
flags
,
int
*
addr_len
)
{
struct
inet_opt
*
inet
=
inet_sk
(
sk
);
in
t
copied
=
0
;
size_
t
copied
=
0
;
int
err
=
-
EOPNOTSUPP
;
struct
sockaddr_in
*
sin
=
(
struct
sockaddr_in
*
)
msg
->
msg_name
;
struct
sk_buff
*
skb
;
...
...
net/ipv4/tcp.c
View file @
c97ddec1
...
...
@@ -1029,7 +1029,7 @@ static inline int select_size(struct sock *sk, struct tcp_opt *tp)
}
int
tcp_sendmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
struct
msghdr
*
msg
,
in
t
size
)
size_
t
size
)
{
struct
iovec
*
iov
;
struct
tcp_opt
*
tp
=
tcp_sk
(
sk
);
...
...
@@ -1498,7 +1498,7 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
*/
int
tcp_recvmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
struct
msghdr
*
msg
,
in
t
len
,
int
nonblock
,
int
flags
,
int
*
addr_len
)
size_
t
len
,
int
nonblock
,
int
flags
,
int
*
addr_len
)
{
struct
tcp_opt
*
tp
=
tcp_sk
(
sk
);
int
copied
=
0
;
...
...
net/ipv4/udp.c
View file @
c97ddec1
...
...
@@ -478,7 +478,7 @@ static unsigned short udp_check(struct udphdr *uh, int len, unsigned long saddr,
}
int
udp_sendmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
struct
msghdr
*
msg
,
in
t
len
)
size_
t
len
)
{
struct
inet_opt
*
inet
=
inet_sk
(
sk
);
struct
udp_opt
*
up
=
udp_sk
(
sk
);
...
...
@@ -493,18 +493,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
int
err
;
int
corkreq
=
up
->
corkflag
||
msg
->
msg_flags
&
MSG_MORE
;
/* This check is ONLY to check for arithmetic overflow
on integer(!) len. Not more! Real check will be made
in ip_append_* --ANK
BTW socket.c -> af_*.c -> ... make multiple
invalid conversions size_t -> int. We MUST repair it f.e.
by replacing all of them with size_t and revise all
the places sort of len += sizeof(struct iphdr)
If len was ULONG_MAX-10 it would be cathastrophe --ANK
*/
if
(
len
<
0
||
len
>
0xFFFF
)
if
(
len
>
0xFFFF
)
return
-
EMSGSIZE
;
/*
...
...
@@ -782,7 +771,7 @@ static __inline__ int udp_checksum_complete(struct sk_buff *skb)
*/
int
udp_recvmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
struct
msghdr
*
msg
,
in
t
len
,
int
noblock
,
int
flags
,
int
*
addr_len
)
size_
t
len
,
int
noblock
,
int
flags
,
int
*
addr_len
)
{
struct
inet_opt
*
inet
=
inet_sk
(
sk
);
struct
sockaddr_in
*
sin
=
(
struct
sockaddr_in
*
)
msg
->
msg_name
;
...
...
net/ipv6/raw.c
View file @
c97ddec1
...
...
@@ -345,13 +345,15 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb)
* we return it, otherwise we block.
*/
static
int
rawv6_recvmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
struct
msghdr
*
msg
,
int
len
,
static
int
rawv6_recvmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
struct
msghdr
*
msg
,
size_t
len
,
int
noblock
,
int
flags
,
int
*
addr_len
)
{
struct
ipv6_pinfo
*
np
=
inet6_sk
(
sk
);
struct
sockaddr_in6
*
sin6
=
(
struct
sockaddr_in6
*
)
msg
->
msg_name
;
struct
sk_buff
*
skb
;
int
copied
,
err
;
size_t
copied
;
int
err
;
if
(
flags
&
MSG_OOB
)
return
-
EOPNOTSUPP
;
...
...
@@ -527,7 +529,8 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
IP6_INC_STATS
(
Ip6OutDiscards
);
return
err
;
}
static
int
rawv6_sendmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
struct
msghdr
*
msg
,
int
len
)
static
int
rawv6_sendmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
struct
msghdr
*
msg
,
size_t
len
)
{
struct
ipv6_txoptions
opt_space
;
struct
sockaddr_in6
*
sin6
=
(
struct
sockaddr_in6
*
)
msg
->
msg_name
;
...
...
net/ipv6/udp.c
View file @
c97ddec1
...
...
@@ -366,12 +366,14 @@ static void udpv6_close(struct sock *sk, long timeout)
* return it, otherwise we block.
*/
static
int
udpv6_recvmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
struct
msghdr
*
msg
,
int
len
,
static
int
udpv6_recvmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
struct
msghdr
*
msg
,
size_t
len
,
int
noblock
,
int
flags
,
int
*
addr_len
)
{
struct
ipv6_pinfo
*
np
=
inet6_sk
(
sk
);
struct
sk_buff
*
skb
;
int
copied
,
err
;
size_t
copied
;
int
err
;
if
(
addr_len
)
*
addr_len
=
sizeof
(
struct
sockaddr_in6
);
...
...
@@ -774,7 +776,8 @@ static int udp_v6_push_pending_frames(struct sock *sk, struct udp_opt *up)
return
err
;
}
static
int
udpv6_sendmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
struct
msghdr
*
msg
,
int
len
)
static
int
udpv6_sendmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
struct
msghdr
*
msg
,
size_t
len
)
{
struct
ipv6_txoptions
opt_space
;
struct
udp_opt
*
up
=
udp_sk
(
sk
);
...
...
@@ -841,7 +844,7 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg
/* Rough check on arithmetic overflow,
better check is made in ip6_build_xmit
*/
if
(
len
<
0
||
len
>
INT_MAX
-
sizeof
(
struct
udphdr
))
if
(
len
>
INT_MAX
-
sizeof
(
struct
udphdr
))
return
-
EMSGSIZE
;
if
(
up
->
pending
)
{
...
...
net/sctp/socket.c
View file @
c97ddec1
...
...
@@ -90,7 +90,7 @@ static inline int sctp_wspace(struct sctp_association *asoc);
static
inline
void
sctp_set_owner_w
(
struct
sctp_chunk
*
chunk
);
static
void
sctp_wfree
(
struct
sk_buff
*
skb
);
static
int
sctp_wait_for_sndbuf
(
struct
sctp_association
*
,
long
*
timeo_p
,
in
t
msg_len
);
size_
t
msg_len
);
static
int
sctp_wait_for_packet
(
struct
sock
*
sk
,
int
*
err
,
long
*
timeo_p
);
static
int
sctp_wait_for_connect
(
struct
sctp_association
*
,
long
*
timeo_p
);
static
int
sctp_wait_for_accept
(
struct
sock
*
sk
,
long
timeo
);
...
...
@@ -943,7 +943,7 @@ static int sctp_error(struct sock *sk, int flags, int err)
SCTP_STATIC
int
sctp_msghdr_parse
(
const
struct
msghdr
*
,
sctp_cmsgs_t
*
);
SCTP_STATIC
int
sctp_sendmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
struct
msghdr
*
msg
,
in
t
msg_len
)
struct
msghdr
*
msg
,
size_
t
msg_len
)
{
struct
sctp_opt
*
sp
;
struct
sctp_endpoint
*
ep
;
...
...
@@ -965,7 +965,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
struct
list_head
*
pos
;
int
msg_flags
=
msg
->
msg_flags
;
SCTP_DEBUG_PRINTK
(
"sctp_sendmsg(sk: %p, msg: %p, msg_len: %
d
)
\n
"
,
SCTP_DEBUG_PRINTK
(
"sctp_sendmsg(sk: %p, msg: %p, msg_len: %
u
)
\n
"
,
sk
,
msg
,
msg_len
);
err
=
0
;
...
...
@@ -1021,7 +1021,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
associd
=
sinfo
->
sinfo_assoc_id
;
}
SCTP_DEBUG_PRINTK
(
"msg_len: %
d
, sinfo_flags: 0x%x
\n
"
,
SCTP_DEBUG_PRINTK
(
"msg_len: %
u
, sinfo_flags: 0x%x
\n
"
,
msg_len
,
sinfo_flags
);
/* MSG_EOF or MSG_ABORT cannot be set on a TCP-style socket. */
...
...
@@ -1377,7 +1377,7 @@ static int sctp_skb_pull(struct sk_buff *skb, int len)
static
struct
sk_buff
*
sctp_skb_recv_datagram
(
struct
sock
*
,
int
,
int
,
int
*
);
SCTP_STATIC
int
sctp_recvmsg
(
struct
kiocb
*
iocb
,
struct
sock
*
sk
,
struct
msghdr
*
msg
,
in
t
len
,
int
noblock
,
struct
msghdr
*
msg
,
size_
t
len
,
int
noblock
,
int
flags
,
int
*
addr_len
)
{
struct
sctp_ulpevent
*
event
=
NULL
;
...
...
@@ -4157,14 +4157,14 @@ static void sctp_wfree(struct sk_buff *skb)
/* Helper function to wait for space in the sndbuf. */
static
int
sctp_wait_for_sndbuf
(
struct
sctp_association
*
asoc
,
long
*
timeo_p
,
in
t
msg_len
)
size_
t
msg_len
)
{
struct
sock
*
sk
=
asoc
->
base
.
sk
;
int
err
=
0
;
long
current_timeo
=
*
timeo_p
;
DEFINE_WAIT
(
wait
);
SCTP_DEBUG_PRINTK
(
"wait_for_sndbuf: asoc=%p, timeo=%ld, msg_len=%
d
\n
"
,
SCTP_DEBUG_PRINTK
(
"wait_for_sndbuf: asoc=%p, timeo=%ld, msg_len=%
u
\n
"
,
asoc
,
(
long
)(
*
timeo_p
),
msg_len
);
/* Increment the association's refcnt. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment