aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/sock.c
diff options
context:
space:
mode:
authorFlorent Revest <[email protected]>2020-12-04 11:36:04 +0000
committerDaniel Borkmann <[email protected]>2020-12-04 21:32:40 +0000
commitdba4a9256bb4d78ef89aaad5f49787aa27fcd5b4 (patch)
tree21572e1bceac8fd13f1c8a190b65316c8c1e8a66 /net/core/sock.c
parentMerge branch 'Improve error handling of verifier tests' (diff)
downloadkernel-dba4a9256bb4d78ef89aaad5f49787aa27fcd5b4.tar.gz
kernel-dba4a9256bb4d78ef89aaad5f49787aa27fcd5b4.zip
net: Remove the err argument from sock_from_file
Currently, the sock_from_file prototype takes an "err" pointer that is either not set or set to -ENOTSOCK IFF the returned socket is NULL. This makes the error redundant and it is ignored by a few callers. This patch simplifies the API by letting callers deduce the error based on whether the returned socket is NULL or not. Suggested-by: Al Viro <[email protected]> Signed-off-by: Florent Revest <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Reviewed-by: KP Singh <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'net/core/sock.c')
-rw-r--r--net/core/sock.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 4fd7e785f177..bbcd4b97eddd 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2827,14 +2827,8 @@ EXPORT_SYMBOL(sock_no_mmap);
void __receive_sock(struct file *file)
{
struct socket *sock;
- int error;
- /*
- * The resulting value of "error" is ignored here since we only
- * need to take action when the file is a socket and testing
- * "sock" for NULL is sufficient.
- */
- sock = sock_from_file(file, &error);
+ sock = sock_from_file(file);
if (sock) {
sock_update_netprioidx(&sock->sk->sk_cgrp_data);
sock_update_classid(&sock->sk->sk_cgrp_data);