From: Thorsten Blum Date: Sat, 21 Mar 2026 13:14:39 +0000 (+0100) Subject: crypto: qce - use memcpy_and_pad in qce_aead_setkey X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be0240f65705b0b125de60d4fc952c013ef74e26;p=thirdparty%2Flinux.git crypto: qce - use memcpy_and_pad in qce_aead_setkey Replace memset() followed by memcpy() with memcpy_and_pad() to simplify the code and to write to ->auth_key only once. Signed-off-by: Thorsten Blum Reviewed-by: Konrad Dybcio Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/qce/aead.c b/drivers/crypto/qce/aead.c index 79e92bc3f7d33..9cb11fada2c4d 100644 --- a/drivers/crypto/qce/aead.c +++ b/drivers/crypto/qce/aead.c @@ -637,8 +637,8 @@ static int qce_aead_setkey(struct crypto_aead *tfm, const u8 *key, unsigned int memcpy(ctx->enc_key, authenc_keys.enckey, authenc_keys.enckeylen); - memset(ctx->auth_key, 0, sizeof(ctx->auth_key)); - memcpy(ctx->auth_key, authenc_keys.authkey, authenc_keys.authkeylen); + memcpy_and_pad(ctx->auth_key, sizeof(ctx->auth_key), + authenc_keys.authkey, authenc_keys.authkeylen, 0); return crypto_aead_setkey(ctx->fallback, key, keylen); }