提交 d832a612 编写于 作者: Y YueHaibing 提交者: Herbert Xu

crypto: amlogic - Use kmemdup in meson_aes_setkey()

Use kmemdup rather than duplicating its implementation
Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
Acked-by: NCorentin Labbe <clabbe@baylibre.com>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 427e6e3a
...@@ -372,10 +372,9 @@ int meson_aes_setkey(struct crypto_skcipher *tfm, const u8 *key, ...@@ -372,10 +372,9 @@ int meson_aes_setkey(struct crypto_skcipher *tfm, const u8 *key,
kfree(op->key); kfree(op->key);
} }
op->keylen = keylen; op->keylen = keylen;
op->key = kmalloc(keylen, GFP_KERNEL | GFP_DMA); op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA);
if (!op->key) if (!op->key)
return -ENOMEM; return -ENOMEM;
memcpy(op->key, key, keylen);
return crypto_sync_skcipher_setkey(op->fallback_tfm, key, keylen); return crypto_sync_skcipher_setkey(op->fallback_tfm, key, keylen);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册