From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vakul Garg Subject: [net-next v4 3/3] net/tls: Remove redundant array allocation. Date: Thu, 19 Jul 2018 21:29:31 +0530 Message-ID: <20180719155931.21497-4-vakul.garg@nxp.com> References: <20180719155931.21497-1-vakul.garg@nxp.com> Mime-Version: 1.0 Content-Type: text/plain Cc: borisp@mellanox.com, aviadye@mellanox.com, davejwatson@fb.com, davem@davemloft.net, Vakul Garg To: netdev@vger.kernel.org Return-path: Received: from mail-db5eur01on0048.outbound.protection.outlook.com ([104.47.2.48]:44704 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726574AbeGSLWp (ORCPT ); Thu, 19 Jul 2018 07:22:45 -0400 In-Reply-To: <20180719155931.21497-1-vakul.garg@nxp.com> Sender: netdev-owner@vger.kernel.org List-ID: In function decrypt_skb(), array allocation in case when sgout is NULL is unnecessary. Instead, local variable sgin_arr[] can be used. Signed-off-by: Vakul Garg --- net/tls/tls_sw.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index e62f288fda31..c33ba3f1c408 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -703,7 +703,6 @@ int decrypt_skb(struct sock *sk, struct sk_buff *skb, memcpy(iv, tls_ctx->rx.iv, TLS_CIPHER_AES_GCM_128_SALT_SIZE); if (!sgout) { nsg = skb_cow_data(skb, 0, &unused) + 1; - sgin = kmalloc_array(nsg, sizeof(*sgin), sk->sk_allocation); sgout = sgin; } @@ -724,9 +723,6 @@ int decrypt_skb(struct sock *sk, struct sk_buff *skb, rxm->full_len - tls_ctx->rx.overhead_size, skb, sk->sk_allocation); - if (sgin != &sgin_arr[0]) - kfree(sgin); - return ret; } -- 2.13.6