Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6082160ybe; Tue, 17 Sep 2019 19:47:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqweUhZ9ZxguWEj+U24RCpmHpkRl+TismY0AzVqytED86AOYWfLn5fAEULME00fIuuadVdW7 X-Received: by 2002:a05:6402:1549:: with SMTP id p9mr8055004edx.221.1568774871508; Tue, 17 Sep 2019 19:47:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568774871; cv=none; d=google.com; s=arc-20160816; b=RrMm1dr4sSmnPo9dyaxkxcLRUQOa/FzLBvdCnei10Aeifiv5/P0e4R8SGXBXspqZCk PKsxuuPJRXrr65V5Ahg4iwOV0RPci5qVccKcQhcvTuQPExM7bLfVG9riRgVhQgpYq62J eJD3rHmFXf0N3VA7lhlPStqjAta7fhPHX+x/v5MnLVOBFOEvf1vcMmkykOC1+KgR1A0i 4sDZytWTj/7n7Ip3CjleAwUgsmaw0PFCZTMVmiOdQiLxV/Z6N6yLFTAu1HfrIcSBVU+1 jlWAmLOaTpEK2DMABgyd/WqKHGnCO/odE9BfrgIaCL1vLNmE2xpIoWeWbOF4c3FUGAl+ kjgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=8Dq0+yG6DL454giGu+/6A7lmsR3y1UUNwsnuxlFDjxA=; b=yyB3gEbq3hCO0xO8rR1j5vN8lWN4hPX2TVjN8Kzn6FEaTcUHzKK9bGe/GfEn0+dKjC HljyPnYRNVaXpmVZs/RLhyKq3UAA4SEDagxtQNiZXogeVxA9T+19EFUivCmmLjSZfl5M a1gEe1rGGIRVX6beN/NCz50yVEm0wdHlhxWgG4irHxXL08Bhi9+kk5usUE+mjOBAcN58 e2ikKtQ18UaRKeUhuO9bKN4XHzxnHBcMfloKO2aS+3fritFZIhwsIA0Tjx3CCB4a3o7S U0y1eFGQO4G4mc4JaYUJBFr5cz7YlNeqstFhkM3P+TRqwKafRyzsi5ScwAiyoWzKokX+ PVrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a16si2229348ejb.54.2019.09.17.19.47.28; Tue, 17 Sep 2019 19:47:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726647AbfIRClg (ORCPT + 99 others); Tue, 17 Sep 2019 22:41:36 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:2671 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725922AbfIRClg (ORCPT ); Tue, 17 Sep 2019 22:41:36 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 6B3BBFCF73A93D0EF5E1; Wed, 18 Sep 2019 10:41:34 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.439.0; Wed, 18 Sep 2019 10:41:27 +0800 From: zhong jiang To: , CC: , , , , Subject: [RESENT PATCH net-next] ixgbe: Use memzero_explicit directly in crypto cases Date: Wed, 18 Sep 2019 10:38:21 +0800 Message-ID: <1568774301-8918-1-git-send-email-zhongjiang@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In general, Use kzfree() to replace memset() + kfree() is feasible and resonable. But It's better to use memzero_explicit() to replace memset() in crypto cases. Signed-off-by: zhong jiang --- drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c index 113f608..7e4f32f 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c @@ -960,9 +960,11 @@ int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf) return 0; err_aead: - kzfree(xs->aead); + memzero_explicit(xs->aead, sizeof(*xs->aead)); + kfree(xs->aead); err_xs: - kzfree(xs); + memzero_explicit(xs, sizeof(*xs)); + kfree(xs); err_out: msgbuf[1] = err; return err; @@ -1047,7 +1049,8 @@ int ixgbe_ipsec_vf_del_sa(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf) ixgbe_ipsec_del_sa(xs); /* remove the xs that was made-up in the add request */ - kzfree(xs); + memzero_explicit(xs, sizeof(*xs)); + kfree(xs); return 0; } -- 1.7.12.4