[17/32] crypto/qat: replace memcpy with structure assignment

Message ID 20250208203142.242284-18-stephen@networkplumber.org (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers
Series Use structure assignment instead of memcpy |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Feb. 8, 2025, 8:22 p.m. UTC
Prefer structure assignment over memcpy.
Found by struct-assign.cocci.

Signed-off-by: Stephen Hemminger <stephen@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(-)
  

Patch

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;