Skip to content

Commit ba42fa7

Browse files
evdenisherbertx
authored andcommitted
crypto: amlogic - use kfree_sensitive()
Use kfree_sensitive() instead of open-coding it. Signed-off-by: Denis Efremov <efremov@linux.com> Tested-by: Corentin Labbe <clabbe@baylibre.com> Acked-by: Corentin Labbe <clabbe@baylibre.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 5705918 commit ba42fa7

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

‎drivers/crypto/amlogic/amlogic-gxl-cipher.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,7 @@ void meson_cipher_exit(struct crypto_tfm *tfm)
340340
{
341341
struct meson_cipher_tfm_ctx *op = crypto_tfm_ctx(tfm);
342342

343-
if (op->key) {
344-
memzero_explicit(op->key, op->keylen);
345-
kfree(op->key);
346-
}
343+
kfree_sensitive(op->key);
347344
crypto_free_skcipher(op->fallback_tfm);
348345
}
349346

@@ -367,10 +364,7 @@ int meson_aes_setkey(struct crypto_skcipher *tfm, const u8 *key,
367364
dev_dbg(mc->dev, "ERROR: Invalid keylen %u\n", keylen);
368365
return -EINVAL;
369366
}
370-
if (op->key) {
371-
memzero_explicit(op->key, op->keylen);
372-
kfree(op->key);
373-
}
367+
kfree_sensitive(op->key);
374368
op->keylen = keylen;
375369
op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA);
376370
if (!op->key)

0 commit comments

Comments
 (0)