Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3137700pxb; Mon, 1 Mar 2021 02:33:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJzaNITZTyNFNngZUF9i+HJyVjWeWqn+NcHBPsHDsnE9bxlT9deev4lE9vG41HBHgQwOTM9w X-Received: by 2002:a05:6402:22bb:: with SMTP id cx27mr953679edb.148.1614594816132; Mon, 01 Mar 2021 02:33:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614594816; cv=none; d=google.com; s=arc-20160816; b=Z4EzNNLwu3XSpRnQ3ilA78xBF8VZnzHLb7CFfwuj/mOr/42kneVk8HSd84DyaXHoPV gJL/Uxcka68lSpagiJ9vjcFzw0EJaHWP+uW3xiW1qARCrn+10NVy7FsFT1ggzb9QuBNd MuTaqFjnZJ3I8vRm9Mg3/abaXWXk36x11tL4tqxwqmiWsEfq8Jy/q0ZejnaKlvqXMm7f xEC2rXCzRtPaNhvmak/INwK6zcmWdtBHcG48kQA+OAxiw0m32uDzrZjeyN4HAfH+1Bbf IWA6EN0F+5tZQfhfDzkKOppcH0+jjcoWf6xHzU6oxqOymJmJX89Q7KvWP0bEcc1fuXVO wBWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=fnieTVr+igDpcjozt4mGqRru3cN7eO8N62GkNJoN/7o=; b=oU5FNRFQXoF9odRPNxi+32agdUWmz9r0+J07v0zx8GFoBJjh9FDGeE61rX26yZONAp ushNX2cnCOC9MHkKe0MQgKB9wwPmlG018ByB6S2l2g5lRTl2SAeFF+bypuzgJvaUbzrg 0p3FHjlqt/BezGxos2K0zsWuRkHXAJKCwxTPWvuvFQGi/rKPbGD7/00DGS7/IYyAHhTe 7+ovXst9YnfPrRvN8WpUZZ/EFeecJXU3b73Tcqg+g53dUdsrye4XGKrjeouSax0pngwn jpBjbFwSv3xwbGNkFEuqhI6Bfi/2vfPQRGJoHE7pW7bJIDNu9qeWbEJ3GxKxNOYPBMUb 6TqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j16si11229816ejm.573.2021.03.01.02.33.03; Mon, 01 Mar 2021 02:33:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230386AbhCAKbh (ORCPT + 99 others); Mon, 1 Mar 2021 05:31:37 -0500 Received: from out30-132.freemail.mail.aliyun.com ([115.124.30.132]:54447 "EHLO out30-132.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234251AbhCAKba (ORCPT ); Mon, 1 Mar 2021 05:31:30 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=yang.lee@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0UPyvTva_1614594646; Received: from j63c13417.sqa.eu95.tbsite.net(mailfrom:yang.lee@linux.alibaba.com fp:SMTPD_---0UPyvTva_1614594646) by smtp.aliyun-inc.com(127.0.0.1); Mon, 01 Mar 2021 18:30:46 +0800 From: Yang Li To: clabbe.montjoie@gmail.com Cc: herbert@gondor.apana.org.au, davem@davemloft.net, mripard@kernel.org, wens@csie.org, jernej.skrabec@siol.net, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Yang Li Subject: [PATCH] crypto: sun8i-ce: rename kfree() to kfree_sensitive() Date: Mon, 1 Mar 2021 18:30:41 +0800 Message-Id: <1614594641-35606-1-git-send-email-yang.lee@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Rename kfree() to kfree_sensitive() to make the intention of the API more explicit. fixed the following coccicheck: ./drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c:30:16-17: WARNING opportunity for kfree_sensitive/kvfree_sensitive (memset at line 29) ./drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c:42:16-17: WARNING opportunity for kfree_sensitive/kvfree_sensitive (memset at line 41) ./drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c:161:8-9: WARNING opportunity for kfree_sensitive/kvfree_sensitive (memset at line 109) Reported-by: Abaci Robot Signed-off-by: Yang Li --- drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c index cfde9ee..8259d52 100644 --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c @@ -27,7 +27,7 @@ void sun8i_ce_prng_exit(struct crypto_tfm *tfm) struct sun8i_ce_rng_tfm_ctx *ctx = crypto_tfm_ctx(tfm); memzero_explicit(ctx->seed, ctx->slen); - kfree(ctx->seed); + kfree_sensitive(ctx->seed); ctx->seed = NULL; ctx->slen = 0; } @@ -39,7 +39,7 @@ int sun8i_ce_prng_seed(struct crypto_rng *tfm, const u8 *seed, if (ctx->seed && ctx->slen != slen) { memzero_explicit(ctx->seed, ctx->slen); - kfree(ctx->seed); + kfree_sensitive(ctx->seed); ctx->slen = 0; ctx->seed = NULL; } @@ -158,7 +158,7 @@ int sun8i_ce_prng_generate(struct crypto_rng *tfm, const u8 *src, } memzero_explicit(d, todo); err_iv: - kfree(d); + kfree_sensitive(d); err_mem: return err; } -- 1.8.3.1