Commit 1ddcbfbf authored by Ziyang Xuan's avatar Ziyang Xuan Committed by Jakub Kicinski

net/tls: remove unnecessary jump instructions in do_tls_setsockopt_conf()

Avoid using "goto" jump instruction unconditionally when we
can return directly. Remove unnecessary jump instructions in
do_tls_setsockopt_conf().
Signed-off-by: default avatarZiyang Xuan <william.xuanziyang@huawei.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 351bdbb6
...@@ -553,10 +553,8 @@ static int do_tls_setsockopt_conf(struct sock *sk, sockptr_t optval, ...@@ -553,10 +553,8 @@ static int do_tls_setsockopt_conf(struct sock *sk, sockptr_t optval,
int rc = 0; int rc = 0;
int conf; int conf;
if (sockptr_is_null(optval) || (optlen < sizeof(*crypto_info))) { if (sockptr_is_null(optval) || (optlen < sizeof(*crypto_info)))
rc = -EINVAL; return -EINVAL;
goto out;
}
if (tx) { if (tx) {
crypto_info = &ctx->crypto_send.info; crypto_info = &ctx->crypto_send.info;
...@@ -567,10 +565,8 @@ static int do_tls_setsockopt_conf(struct sock *sk, sockptr_t optval, ...@@ -567,10 +565,8 @@ static int do_tls_setsockopt_conf(struct sock *sk, sockptr_t optval,
} }
/* Currently we don't support set crypto info more than one time */ /* Currently we don't support set crypto info more than one time */
if (TLS_CRYPTO_INFO_READY(crypto_info)) { if (TLS_CRYPTO_INFO_READY(crypto_info))
rc = -EBUSY; return -EBUSY;
goto out;
}
rc = copy_from_sockptr(crypto_info, optval, sizeof(*crypto_info)); rc = copy_from_sockptr(crypto_info, optval, sizeof(*crypto_info));
if (rc) { if (rc) {
...@@ -672,11 +668,10 @@ static int do_tls_setsockopt_conf(struct sock *sk, sockptr_t optval, ...@@ -672,11 +668,10 @@ static int do_tls_setsockopt_conf(struct sock *sk, sockptr_t optval,
ctx->sk_write_space = sk->sk_write_space; ctx->sk_write_space = sk->sk_write_space;
sk->sk_write_space = tls_write_space; sk->sk_write_space = tls_write_space;
} }
goto out; return 0;
err_crypto_info: err_crypto_info:
memzero_explicit(crypto_info, sizeof(union tls_crypto_context)); memzero_explicit(crypto_info, sizeof(union tls_crypto_context));
out:
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment