[PATCH 17/32] crypto/qat: replace memcpy with structure assignment
Stephen Hemminger
stephen at networkplumber.org
Sat Feb 8 21:22:09 CET 2025
Prefer structure assignment over memcpy.
Found by struct-assign.cocci.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c | 3 +--
drivers/crypto/qat/dev/qat_crypto_pmd_gen5.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c b/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c
index af664fb9b9..478e766b97 100644
--- a/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c
+++ b/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c
@@ -277,8 +277,7 @@ qat_sym_crypto_cap_get_gen3(struct qat_cryptodev_private *internals,
RTE_CRYPTO_CIPHER_DES_DOCSISBPI)))
continue;
- memcpy(addr + curr_capa, capabilities + iter,
- sizeof(struct rte_cryptodev_capabilities));
+ *(addr + curr_capa) = *(capabilities + iter);
if (internals->qat_dev->options.has_wireless_slice && (
check_auth_capa(&capabilities[iter],
diff --git a/drivers/crypto/qat/dev/qat_crypto_pmd_gen5.c b/drivers/crypto/qat/dev/qat_crypto_pmd_gen5.c
index e1302e9b36..7d2d234959 100644
--- a/drivers/crypto/qat/dev/qat_crypto_pmd_gen5.c
+++ b/drivers/crypto/qat/dev/qat_crypto_pmd_gen5.c
@@ -203,8 +203,7 @@ qat_sym_crypto_cap_get_gen5(struct qat_cryptodev_private *internals,
continue;
}
- memcpy(addr + curr_capa, capabilities + iter,
- sizeof(struct rte_cryptodev_capabilities));
+ *(addr + curr_capa) = *(capabilities + iter);
curr_capa++;
}
internals->qat_dev_capabilities = internals->capa_mz->addr;
--
2.47.2
More information about the dev
mailing list