Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1643a35f authored by Mihnea Dobrescu-Balaur's avatar Mihnea Dobrescu-Balaur Committed by Herbert Xu
Browse files

crypto: ux500 - replace kmalloc and then memcpy with kmemdup

parent 5de88752
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -1368,14 +1368,12 @@ static int hash_setkey(struct crypto_ahash *tfm,
	/**
	 * Freed in final.
	 */
	ctx->key = kmalloc(keylen, GFP_KERNEL);
	ctx->key = kmemdup(key, keylen, GFP_KERNEL);
	if (!ctx->key) {
		pr_err(DEV_DBG_NAME " [%s] Failed to allocate ctx->key "
		       "for %d\n", __func__, alg);
		return -ENOMEM;
	}

	memcpy(ctx->key, key, keylen);
	ctx->keylen = keylen;

	return ret;