Merge branch 'tls-warnings'
Jakub Kicinski says: ==================== net/tls: fix W=1 build warnings This small series cleans up two outstanding W=1 build warnings in tls code. Both are set but not used variables. The first case looks fairly straightforward. In the second I think it's better to propagate the error code, even if not doing some does not lead to a crash with current code. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
f50c8a019b
|
@ -541,14 +541,11 @@ static int tls_device_push_pending_record(struct sock *sk, int flags)
|
||||||
|
|
||||||
void tls_device_write_space(struct sock *sk, struct tls_context *ctx)
|
void tls_device_write_space(struct sock *sk, struct tls_context *ctx)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
|
||||||
|
|
||||||
if (!sk->sk_write_pending && tls_is_partially_sent_record(ctx)) {
|
if (!sk->sk_write_pending && tls_is_partially_sent_record(ctx)) {
|
||||||
gfp_t sk_allocation = sk->sk_allocation;
|
gfp_t sk_allocation = sk->sk_allocation;
|
||||||
|
|
||||||
sk->sk_allocation = GFP_ATOMIC;
|
sk->sk_allocation = GFP_ATOMIC;
|
||||||
rc = tls_push_partial_record(sk, ctx,
|
tls_push_partial_record(sk, ctx, MSG_DONTWAIT | MSG_NOSIGNAL);
|
||||||
MSG_DONTWAIT | MSG_NOSIGNAL);
|
|
||||||
sk->sk_allocation = sk_allocation;
|
sk->sk_allocation = sk_allocation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,23 +119,25 @@ static int skb_nsg(struct sk_buff *skb, int offset, int len)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int padding_length(struct tls_sw_context_rx *ctx,
|
static int padding_length(struct tls_sw_context_rx *ctx,
|
||||||
struct tls_context *tls_ctx, struct sk_buff *skb)
|
struct tls_prot_info *prot, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct strp_msg *rxm = strp_msg(skb);
|
struct strp_msg *rxm = strp_msg(skb);
|
||||||
int sub = 0;
|
int sub = 0;
|
||||||
|
|
||||||
/* Determine zero-padding length */
|
/* Determine zero-padding length */
|
||||||
if (tls_ctx->prot_info.version == TLS_1_3_VERSION) {
|
if (prot->version == TLS_1_3_VERSION) {
|
||||||
char content_type = 0;
|
char content_type = 0;
|
||||||
int err;
|
int err;
|
||||||
int back = 17;
|
int back = 17;
|
||||||
|
|
||||||
while (content_type == 0) {
|
while (content_type == 0) {
|
||||||
if (back > rxm->full_len)
|
if (back > rxm->full_len - prot->prepend_size)
|
||||||
return -EBADMSG;
|
return -EBADMSG;
|
||||||
err = skb_copy_bits(skb,
|
err = skb_copy_bits(skb,
|
||||||
rxm->offset + rxm->full_len - back,
|
rxm->offset + rxm->full_len - back,
|
||||||
&content_type, 1);
|
&content_type, 1);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
if (content_type)
|
if (content_type)
|
||||||
break;
|
break;
|
||||||
sub++;
|
sub++;
|
||||||
|
@ -170,9 +172,17 @@ static void tls_decrypt_done(struct crypto_async_request *req, int err)
|
||||||
tls_err_abort(skb->sk, err);
|
tls_err_abort(skb->sk, err);
|
||||||
} else {
|
} else {
|
||||||
struct strp_msg *rxm = strp_msg(skb);
|
struct strp_msg *rxm = strp_msg(skb);
|
||||||
rxm->full_len -= padding_length(ctx, tls_ctx, skb);
|
int pad;
|
||||||
rxm->offset += prot->prepend_size;
|
|
||||||
rxm->full_len -= prot->overhead_size;
|
pad = padding_length(ctx, prot, skb);
|
||||||
|
if (pad < 0) {
|
||||||
|
ctx->async_wait.err = pad;
|
||||||
|
tls_err_abort(skb->sk, pad);
|
||||||
|
} else {
|
||||||
|
rxm->full_len -= pad;
|
||||||
|
rxm->offset += prot->prepend_size;
|
||||||
|
rxm->full_len -= prot->overhead_size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* After using skb->sk to propagate sk through crypto async callback
|
/* After using skb->sk to propagate sk through crypto async callback
|
||||||
|
@ -1478,7 +1488,7 @@ static int decrypt_skb_update(struct sock *sk, struct sk_buff *skb,
|
||||||
struct tls_prot_info *prot = &tls_ctx->prot_info;
|
struct tls_prot_info *prot = &tls_ctx->prot_info;
|
||||||
int version = prot->version;
|
int version = prot->version;
|
||||||
struct strp_msg *rxm = strp_msg(skb);
|
struct strp_msg *rxm = strp_msg(skb);
|
||||||
int err = 0;
|
int pad, err = 0;
|
||||||
|
|
||||||
if (!ctx->decrypted) {
|
if (!ctx->decrypted) {
|
||||||
#ifdef CONFIG_TLS_DEVICE
|
#ifdef CONFIG_TLS_DEVICE
|
||||||
|
@ -1501,7 +1511,11 @@ static int decrypt_skb_update(struct sock *sk, struct sk_buff *skb,
|
||||||
*zc = false;
|
*zc = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
rxm->full_len -= padding_length(ctx, tls_ctx, skb);
|
pad = padding_length(ctx, prot, skb);
|
||||||
|
if (pad < 0)
|
||||||
|
return pad;
|
||||||
|
|
||||||
|
rxm->full_len -= pad;
|
||||||
rxm->offset += prot->prepend_size;
|
rxm->offset += prot->prepend_size;
|
||||||
rxm->full_len -= prot->overhead_size;
|
rxm->full_len -= prot->overhead_size;
|
||||||
tls_advance_record_sn(sk, &tls_ctx->rx, version);
|
tls_advance_record_sn(sk, &tls_ctx->rx, version);
|
||||||
|
|
Loading…
Reference in New Issue