* [PATCH net] net/socket: fix type in assignment and trim long line
@ 2017-07-21 16:49 Paolo Abeni
2017-07-24 21:17 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Abeni @ 2017-07-21 16:49 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, Al Viro
The commit ffb07550c76f ("copy_msghdr_from_user(): get rid of
field-by-field copyin") introduce a new sparse warning:
net/socket.c:1919:27: warning: incorrect type in assignment (different address spaces)
net/socket.c:1919:27: expected void *msg_control
net/socket.c:1919:27: got void [noderef] <asn:1>*[addressable] msg_control
and a line above 80 chars, let's fix them
Fixes: ffb07550c76f ("copy_msghdr_from_user(): get rid of field-by-field copyin")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
I noticed only because I had a very similar commit pending;
replacing the field-by-field copyin with a single copy_from_user()
gives measurable performance improvements - more than 10% under
UDP flood if using recvmsg() to sink the traffic
---
net/socket.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/socket.c b/net/socket.c
index bf21226..ad22df1 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1916,7 +1916,7 @@ static int copy_msghdr_from_user(struct msghdr *kmsg,
if (copy_from_user(&msg, umsg, sizeof(*umsg)))
return -EFAULT;
- kmsg->msg_control = msg.msg_control;
+ kmsg->msg_control = (void __force *)msg.msg_control;
kmsg->msg_controllen = msg.msg_controllen;
kmsg->msg_flags = msg.msg_flags;
@@ -1935,7 +1935,8 @@ static int copy_msghdr_from_user(struct msghdr *kmsg,
if (msg.msg_name && kmsg->msg_namelen) {
if (!save_addr) {
- err = move_addr_to_kernel(msg.msg_name, kmsg->msg_namelen,
+ err = move_addr_to_kernel(msg.msg_name,
+ kmsg->msg_namelen,
kmsg->msg_name);
if (err < 0)
return err;
--
2.9.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net] net/socket: fix type in assignment and trim long line
2017-07-21 16:49 [PATCH net] net/socket: fix type in assignment and trim long line Paolo Abeni
@ 2017-07-24 21:17 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-07-24 21:17 UTC (permalink / raw)
To: pabeni; +Cc: netdev, viro
From: Paolo Abeni <pabeni@redhat.com>
Date: Fri, 21 Jul 2017 18:49:45 +0200
> The commit ffb07550c76f ("copy_msghdr_from_user(): get rid of
> field-by-field copyin") introduce a new sparse warning:
>
> net/socket.c:1919:27: warning: incorrect type in assignment (different address spaces)
> net/socket.c:1919:27: expected void *msg_control
> net/socket.c:1919:27: got void [noderef] <asn:1>*[addressable] msg_control
>
> and a line above 80 chars, let's fix them
>
> Fixes: ffb07550c76f ("copy_msghdr_from_user(): get rid of field-by-field copyin")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-07-24 21:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-21 16:49 [PATCH net] net/socket: fix type in assignment and trim long line Paolo Abeni
2017-07-24 21:17 ` David Miller
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).