Message ID | 20200827064402.7130-3-efremov@linux.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Herbert Xu |
Headers | show |
Series | crypto: use kfree_sensitive() | expand |
On Thu, Aug 27, 2020 at 09:44:00AM +0300, Denis Efremov wrote: > Use kfree_sensitive() instead of open-coding it. > > Signed-off-by: Denis Efremov <efremov@linux.com> > --- > drivers/crypto/amlogic/amlogic-gxl-cipher.c | 10 ++-------- > 1 file changed, 2 insertions(+), 8 deletions(-) > For the whole serie you didnt use getmaintainers, so nor sunxi and amlogic maintainers where CC. And my baylibre address which is the address for this driver. Anyway, for this case the patch is trivial enough. Tested-by: Corentin Labbe <clabbe@baylibre.com> Acked-by: Corentin Labbe <clabbe@baylibre.com> Regards
diff --git a/drivers/crypto/amlogic/amlogic-gxl-cipher.c b/drivers/crypto/amlogic/amlogic-gxl-cipher.c index d93210726697..ee5998af2fe8 100644 --- a/drivers/crypto/amlogic/amlogic-gxl-cipher.c +++ b/drivers/crypto/amlogic/amlogic-gxl-cipher.c @@ -340,10 +340,7 @@ void meson_cipher_exit(struct crypto_tfm *tfm) { struct meson_cipher_tfm_ctx *op = crypto_tfm_ctx(tfm); - if (op->key) { - memzero_explicit(op->key, op->keylen); - kfree(op->key); - } + kfree_sensitive(op->key); crypto_free_skcipher(op->fallback_tfm); } @@ -367,10 +364,7 @@ int meson_aes_setkey(struct crypto_skcipher *tfm, const u8 *key, dev_dbg(mc->dev, "ERROR: Invalid keylen %u\n", keylen); return -EINVAL; } - if (op->key) { - memzero_explicit(op->key, op->keylen); - kfree(op->key); - } + kfree_sensitive(op->key); op->keylen = keylen; op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA); if (!op->key)
Use kfree_sensitive() instead of open-coding it. Signed-off-by: Denis Efremov <efremov@linux.com> --- drivers/crypto/amlogic/amlogic-gxl-cipher.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)