From nobody Mon Apr 6 22:15:24 2026 Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18BDC3EF641 for ; Tue, 17 Mar 2026 16:53:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773766431; cv=none; b=V/L/JhdjkELy4gHfUqf3ks0lrbZEX17Gr4+F1qXlIli6bn00IlARF0slF+Qa2SQH3Qc0C+kWlVcYViwBAC3pIemXZ/WPcuWY2zfLv/EgZjY4e2ZTZRvRiMQlOTYbvoSnhtEmIweiyfR3xF6UNqLg4zt9D+LZeyyXdiRSJ4OxwzQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773766431; c=relaxed/simple; bh=uUZqgp56tETGHnqGOVMnhu/DmaoMiy26Kaph7kGSWAU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Nk50LTHb3nA6hK+vW8V2aTpeClzewInSmbw2zVL5CdW62ZdNy2zlmcGj0iNfy03bFvEeKn7YW2RAmY0gkWviFa7rlprDrCTwL+BEU+qNEgc8JH4GAn8/8gSgvVe3MwlhlcnKCeeq08BIPmKjZ4mzTngwKPFX49vOEjpjZyINxB4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=EpzFASh2; arc=none smtp.client-ip=91.218.175.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="EpzFASh2" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1773766423; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=AB4PjFxa6AWYuYKRdmkExBbCIEkIbBbhTthhg8WwMeA=; b=EpzFASh2ZKCjNH2eBsBSN4FxoAHY49Z+Dn2wROKsqo2nMJC6GGQC1KyRmWVaNcdLm4Pkik r92aJAJU2TEL8B1rmpSNKUEzWBvuEqK9Ks+bF7gxdyqvwIWKiZTcYxUIiglHpY1OfQlUqN +wSC74kkBsxrwTh3Kre8yDEl0v9XKNU= From: Thorsten Blum To: Srujana Challa , Bharat Bhushan , Herbert Xu , "David S. Miller" Cc: Thorsten Blum , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] crypto: marvell/cesa - use memcpy_and_pad in mv_cesa_ahash_export Date: Tue, 17 Mar 2026 17:52:57 +0100 Message-ID: <20260317165258.1304521-2-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=813; i=thorsten.blum@linux.dev; h=from:subject; bh=uUZqgp56tETGHnqGOVMnhu/DmaoMiy26Kaph7kGSWAU=; b=owGbwMvMwCUWt7pQ4caZUj3G02pJDJk72145zatvuDyh+emKhBNnWht4dhvIaYmGlM3OnZimd kOgOzizo5SFQYyLQVZMkeXBrB8zfEtrKjeZROyEmcPKBDKEgYtTACbi7MnIcHDFmRXufxm2pdVE Lf+c8p/T8riSbuPqRSlcFlN1rkgXdDMyTBNMTv2ed3S34N/QCo3A2k/WeZ8+VpvWVtl7tZ6/cZW RDwA= X-Developer-Key: i=thorsten.blum@linux.dev; a=openpgp; fpr=1D60735E8AEF3BE473B69D84733678FD8DFEEAD4 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Replace memset() followed by memcpy() with memcpy_and_pad() to simplify the code and to write to 'cache' only once. Signed-off-by: Thorsten Blum --- drivers/crypto/marvell/cesa/hash.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/crypto/marvell/cesa/hash.c b/drivers/crypto/marvell/ce= sa/hash.c index 5103d36cdfdb..2f203042d9bd 100644 --- a/drivers/crypto/marvell/cesa/hash.c +++ b/drivers/crypto/marvell/cesa/hash.c @@ -847,8 +847,7 @@ static int mv_cesa_ahash_export(struct ahash_request *r= eq, void *hash, =20 *len =3D creq->len; memcpy(hash, creq->state, digsize); - memset(cache, 0, blocksize); - memcpy(cache, creq->cache, creq->cache_ptr); + memcpy_and_pad(cache, blocksize, creq->cache, creq->cache_ptr, 0); =20 return 0; }