From: Arek Kusztal Date: Tue, 7 Jun 2016 16:58:13 +0000 (+0100) Subject: qat: avoid strict-aliasing break X-Git-Tag: spdx-start~6830 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=acc32dc9c00f5c64530f4761ea4e665ca7401c41;p=dpdk.git qat: avoid strict-aliasing break To avoid GCC warning about "dereferencing type-punned pointer will break strict-aliasing rules" aad_len pointer is dereferenced instead of direct dereferencing of uint32_t* cast of the middle of an array. Signed-off-by: Arek Kusztal Acked-by: Deepak Kumar Jain --- diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c index bcccdf4f3f..aa108d4725 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c @@ -616,10 +616,11 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc, * Write (the length of AAD) into bytes 16-19 of state2 * in big-endian format. This field is 8 bytes */ - *(uint32_t *)&(hash->sha.state1[ + uint32_t *aad_len = (uint32_t *)&hash->sha.state1[ ICP_QAT_HW_GALOIS_128_STATE1_SZ + - ICP_QAT_HW_GALOIS_H_SZ]) = - rte_bswap32(add_auth_data_length); + ICP_QAT_HW_GALOIS_H_SZ]; + *aad_len = rte_bswap32(add_auth_data_length); + proto = ICP_QAT_FW_LA_GCM_PROTO; } else if (cdesc->qat_hash_alg == ICP_QAT_HW_AUTH_ALGO_SNOW_3G_UIA2) { proto = ICP_QAT_FW_LA_SNOW_3G_PROTO;