From 7c487ba04aed36b00e30d4d4e5c0159ab481bb2d Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Mon, 13 Aug 2018 10:44:56 +0200 Subject: [PATCH] net: tls: Use EINVAL for NULL pointer error in option setters Originally EFAULT was used to indicate NULL pointer error in TLS option set/get functions. EINVAL was suggested to be more apropriate error code for this case, hence replace it. Signed-off-by: Robert Lubos --- subsys/net/lib/sockets/sockets_tls.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/subsys/net/lib/sockets/sockets_tls.c b/subsys/net/lib/sockets/sockets_tls.c index a821f613449..99b2a8a09d0 100644 --- a/subsys/net/lib/sockets/sockets_tls.c +++ b/subsys/net/lib/sockets/sockets_tls.c @@ -888,7 +888,7 @@ static int tls_opt_sec_tag_list_set(struct net_context *context, int sec_tag_cnt; if (!optval) { - return -EFAULT; + return -EINVAL; } if (optlen % sizeof(sec_tag_t) != 0) { @@ -945,7 +945,7 @@ static int tls_opt_ciphersuite_list_set(struct net_context *context, int cipher_cnt; if (!optval) { - return -EFAULT; + return -EINVAL; } if (optlen % sizeof(int) != 0) { @@ -1022,7 +1022,7 @@ static int tls_opt_peer_verify_set(struct net_context *context, int *peer_verify; if (!optval) { - return -EFAULT; + return -EINVAL; } if (optlen != sizeof(int)) { @@ -1048,7 +1048,7 @@ static int tls_opt_role_set(struct net_context *context, const void *optval, int *role; if (!optval) { - return -EFAULT; + return -EINVAL; } if (optlen != sizeof(int)) { @@ -1720,7 +1720,7 @@ int ztls_getsockopt(int sock, int level, int optname, } if (!optval || !optlen) { - return -EFAULT; + return -EINVAL; } switch (optname) {