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
Kirill Smelkov
linux
Commits
45dcc687
Commit
45dcc687
authored
Nov 15, 2014
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tipc_msg_build(): pass msghdr instead of its ->msg_iov
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
562640f3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
9 deletions
+8
-9
net/tipc/msg.c
net/tipc/msg.c
+4
-4
net/tipc/msg.h
net/tipc/msg.h
+1
-1
net/tipc/socket.c
net/tipc/socket.c
+3
-4
No files found.
net/tipc/msg.c
View file @
45dcc687
...
@@ -162,14 +162,14 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf)
...
@@ -162,14 +162,14 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf)
/**
/**
* tipc_msg_build - create buffer chain containing specified header and data
* tipc_msg_build - create buffer chain containing specified header and data
* @mhdr: Message header, to be prepended to data
* @mhdr: Message header, to be prepended to data
* @
iov: User data
* @
m: User message
* @offset: Posision in iov to start copying from
* @offset: Posision in iov to start copying from
* @dsz: Total length of user data
* @dsz: Total length of user data
* @pktmax: Max packet size that can be used
* @pktmax: Max packet size that can be used
* @chain: Buffer or chain of buffers to be returned to caller
* @chain: Buffer or chain of buffers to be returned to caller
* Returns message data size or errno: -ENOMEM, -EFAULT
* Returns message data size or errno: -ENOMEM, -EFAULT
*/
*/
int
tipc_msg_build
(
struct
tipc_msg
*
mhdr
,
struct
iovec
const
*
iov
,
int
tipc_msg_build
(
struct
tipc_msg
*
mhdr
,
struct
msghdr
*
m
,
int
offset
,
int
dsz
,
int
pktmax
,
struct
sk_buff
**
chain
)
int
offset
,
int
dsz
,
int
pktmax
,
struct
sk_buff
**
chain
)
{
{
int
mhsz
=
msg_hdr_sz
(
mhdr
);
int
mhsz
=
msg_hdr_sz
(
mhdr
);
...
@@ -194,7 +194,7 @@ int tipc_msg_build(struct tipc_msg *mhdr, struct iovec const *iov,
...
@@ -194,7 +194,7 @@ int tipc_msg_build(struct tipc_msg *mhdr, struct iovec const *iov,
skb_copy_to_linear_data
(
buf
,
mhdr
,
mhsz
);
skb_copy_to_linear_data
(
buf
,
mhdr
,
mhsz
);
pktpos
=
buf
->
data
+
mhsz
;
pktpos
=
buf
->
data
+
mhsz
;
TIPC_SKB_CB
(
buf
)
->
chain_sz
=
1
;
TIPC_SKB_CB
(
buf
)
->
chain_sz
=
1
;
if
(
!
dsz
||
!
memcpy_fromiovecend
(
pktpos
,
iov
,
offset
,
dsz
))
if
(
!
dsz
||
!
memcpy_fromiovecend
(
pktpos
,
m
->
msg_
iov
,
offset
,
dsz
))
return
dsz
;
return
dsz
;
rc
=
-
EFAULT
;
rc
=
-
EFAULT
;
goto
error
;
goto
error
;
...
@@ -223,7 +223,7 @@ int tipc_msg_build(struct tipc_msg *mhdr, struct iovec const *iov,
...
@@ -223,7 +223,7 @@ int tipc_msg_build(struct tipc_msg *mhdr, struct iovec const *iov,
if
(
drem
<
pktrem
)
if
(
drem
<
pktrem
)
pktrem
=
drem
;
pktrem
=
drem
;
if
(
memcpy_fromiovecend
(
pktpos
,
iov
,
offset
,
pktrem
))
{
if
(
memcpy_fromiovecend
(
pktpos
,
m
->
msg_
iov
,
offset
,
pktrem
))
{
rc
=
-
EFAULT
;
rc
=
-
EFAULT
;
goto
error
;
goto
error
;
}
}
...
...
net/tipc/msg.h
View file @
45dcc687
...
@@ -743,7 +743,7 @@ bool tipc_msg_bundle(struct sk_buff *bbuf, struct sk_buff *buf, u32 mtu);
...
@@ -743,7 +743,7 @@ bool tipc_msg_bundle(struct sk_buff *bbuf, struct sk_buff *buf, u32 mtu);
bool
tipc_msg_make_bundle
(
struct
sk_buff
**
buf
,
u32
mtu
,
u32
dnode
);
bool
tipc_msg_make_bundle
(
struct
sk_buff
**
buf
,
u32
mtu
,
u32
dnode
);
int
tipc_msg_build
(
struct
tipc_msg
*
mhdr
,
struct
iovec
const
*
iov
,
int
tipc_msg_build
(
struct
tipc_msg
*
mhdr
,
struct
msghdr
*
m
,
int
offset
,
int
dsz
,
int
mtu
,
struct
sk_buff
**
chain
);
int
offset
,
int
dsz
,
int
mtu
,
struct
sk_buff
**
chain
);
struct
sk_buff
*
tipc_msg_reassemble
(
struct
sk_buff
*
chain
);
struct
sk_buff
*
tipc_msg_reassemble
(
struct
sk_buff
*
chain
);
...
...
net/tipc/socket.c
View file @
45dcc687
...
@@ -727,7 +727,7 @@ static int tipc_sendmcast(struct socket *sock, struct tipc_name_seq *seq,
...
@@ -727,7 +727,7 @@ static int tipc_sendmcast(struct socket *sock, struct tipc_name_seq *seq,
new_mtu:
new_mtu:
mtu
=
tipc_bclink_get_mtu
();
mtu
=
tipc_bclink_get_mtu
();
rc
=
tipc_msg_build
(
mhdr
,
msg
->
msg_iov
,
0
,
dsz
,
mtu
,
&
buf
);
rc
=
tipc_msg_build
(
mhdr
,
msg
,
0
,
dsz
,
mtu
,
&
buf
);
if
(
unlikely
(
rc
<
0
))
if
(
unlikely
(
rc
<
0
))
return
rc
;
return
rc
;
...
@@ -905,7 +905,6 @@ static int tipc_sendmsg(struct kiocb *iocb, struct socket *sock,
...
@@ -905,7 +905,6 @@ static int tipc_sendmsg(struct kiocb *iocb, struct socket *sock,
struct
sock
*
sk
=
sock
->
sk
;
struct
sock
*
sk
=
sock
->
sk
;
struct
tipc_sock
*
tsk
=
tipc_sk
(
sk
);
struct
tipc_sock
*
tsk
=
tipc_sk
(
sk
);
struct
tipc_msg
*
mhdr
=
&
tsk
->
phdr
;
struct
tipc_msg
*
mhdr
=
&
tsk
->
phdr
;
struct
iovec
*
iov
=
m
->
msg_iov
;
u32
dnode
,
dport
;
u32
dnode
,
dport
;
struct
sk_buff
*
buf
;
struct
sk_buff
*
buf
;
struct
tipc_name_seq
*
seq
=
&
dest
->
addr
.
nameseq
;
struct
tipc_name_seq
*
seq
=
&
dest
->
addr
.
nameseq
;
...
@@ -982,7 +981,7 @@ static int tipc_sendmsg(struct kiocb *iocb, struct socket *sock,
...
@@ -982,7 +981,7 @@ static int tipc_sendmsg(struct kiocb *iocb, struct socket *sock,
new_mtu:
new_mtu:
mtu
=
tipc_node_get_mtu
(
dnode
,
tsk
->
ref
);
mtu
=
tipc_node_get_mtu
(
dnode
,
tsk
->
ref
);
rc
=
tipc_msg_build
(
mhdr
,
iov
,
0
,
dsz
,
mtu
,
&
buf
);
rc
=
tipc_msg_build
(
mhdr
,
m
,
0
,
dsz
,
mtu
,
&
buf
);
if
(
rc
<
0
)
if
(
rc
<
0
)
goto
exit
;
goto
exit
;
...
@@ -1094,7 +1093,7 @@ static int tipc_send_stream(struct kiocb *iocb, struct socket *sock,
...
@@ -1094,7 +1093,7 @@ static int tipc_send_stream(struct kiocb *iocb, struct socket *sock,
next:
next:
mtu
=
tsk
->
max_pkt
;
mtu
=
tsk
->
max_pkt
;
send
=
min_t
(
uint
,
dsz
-
sent
,
TIPC_MAX_USER_MSG_SIZE
);
send
=
min_t
(
uint
,
dsz
-
sent
,
TIPC_MAX_USER_MSG_SIZE
);
rc
=
tipc_msg_build
(
mhdr
,
m
->
msg_iov
,
sent
,
send
,
mtu
,
&
buf
);
rc
=
tipc_msg_build
(
mhdr
,
m
,
sent
,
send
,
mtu
,
&
buf
);
if
(
unlikely
(
rc
<
0
))
if
(
unlikely
(
rc
<
0
))
goto
exit
;
goto
exit
;
do
{
do
{
...
...
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