Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5099272ybe; Tue, 17 Sep 2019 02:34:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqx8MUUr3qNKmumx3rjZVxhR9oqcHVChxHIRL3cMLVuIiBRG1uZWvitww7apvuU8IdUM9pvi X-Received: by 2002:a50:eb8b:: with SMTP id y11mr3497020edr.200.1568712896312; Tue, 17 Sep 2019 02:34:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568712896; cv=none; d=google.com; s=arc-20160816; b=K1eyUqaDx0GRxH2yUEgymca4GsSEVT3lf+xDABrr4TqQO/y99izisrz0FVorVTsNfQ 0ZAOmn5rP9QUR0lFQ3FNlp6Kl3VjV31X2tG8j0wFK+xuM8DKrEdrGZ/fYKatHpynWJeo rxSgbuvr40FpovFJ08O0wzrs9C767eWMDXzAZhwtGS66CC9jnwieUH8om/qhud/FXsq2 PwZx3C+uIRBsXrU5bFnl3XDktB8FwszsQk8op09GObTLtVOgTJ9nQO6zI5XPFJJImPdw vb1c4d/cNGBLPpK1CjHYV5yyjD6pKYhvLgnnv/tjbrkBI5AnZASHQP2Oqy2AizMIFdKR 9Hdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :references:subject:cc:to:mime-version:user-agent:from:date :message-id; bh=/QwWu8LPhTzX0mJ+ncrb3rWr2KOkya4JoL1iq5vcYG0=; b=eSjvXBr4EgUyyDkpiXta/p12rEHIYL9/2rm9nskBgDwNlIz9noS1QpUfuUGlOxKKB2 lhWYDOVkZGdqOJE5gt3XH8HD8mY9Q7SmIiaqox4i4ftuc7OJjp5tnBP6WPJmk1jLyJQQ y952Fbmg4LXSrkWqphFZMDzoTImlRypsIjLidxSr0LZW22MRW4H0xlyiY1SJldz3So+J MZc4bAT5cHjPNAl3K0AjUdqeGzNRbbjc3hBizvmezV9H7LykKviSgz3CT915zLmgFBw9 L/EJhDYFlXMqkMzUJ7Dj8fHyjoglo0NzgUR0/cT5yynpKdd2E8biZ8PBa6JKkSBz7uy4 fcVQ== 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 f1si762809eje.338.2019.09.17.02.34.33; Tue, 17 Sep 2019 02:34:56 -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 S2390330AbfIQDUE (ORCPT + 99 others); Mon, 16 Sep 2019 23:20:04 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:2227 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727097AbfIQDUD (ORCPT ); Mon, 16 Sep 2019 23:20:03 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 84CB24867C721C163196; Tue, 17 Sep 2019 11:20:01 +0800 (CST) Received: from [127.0.0.1] (10.177.29.68) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.439.0; Tue, 17 Sep 2019 11:19:57 +0800 Message-ID: <5D8050DC.4010909@huawei.com> Date: Tue, 17 Sep 2019 11:19:56 +0800 From: zhong jiang User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Jakub Kicinski CC: , , , , Subject: Re: [PATCH 1/3] ixgbe: Use kzfree() rather than its implementation. References: <1567564752-6430-1-git-send-email-zhongjiang@huawei.com> <1567564752-6430-2-git-send-email-zhongjiang@huawei.com> <20190916194319.712d81cc@cakuba.netronome.com> In-Reply-To: <20190916194319.712d81cc@cakuba.netronome.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.29.68] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/9/17 10:43, Jakub Kicinski wrote: > On Wed, 4 Sep 2019 10:39:10 +0800, zhong jiang wrote: >> Use kzfree() instead of memset() + kfree(). >> >> Signed-off-by: zhong jiang >> --- >> drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 9 +++------ >> 1 file changed, 3 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c >> index 31629fc..113f608 100644 >> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c >> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c >> @@ -960,11 +960,9 @@ int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf) >> return 0; >> >> err_aead: >> - memset(xs->aead, 0, sizeof(*xs->aead)); >> - kfree(xs->aead); >> + kzfree(xs->aead); >> err_xs: >> - memset(xs, 0, sizeof(*xs)); >> - kfree(xs); >> + kzfree(xs); >> err_out: >> msgbuf[1] = err; >> return err; >> @@ -1049,8 +1047,7 @@ 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 */ >> - memset(xs, 0, sizeof(*xs)); >> - kfree(xs); >> + kzfree(xs); >> >> return 0; >> } > All the crypto cases should really be converted to memzero_explicit(). It's better to do that. I will repost it in v2. Thanks, zhong jiang