From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 695389AF2 for ; Tue, 7 Jun 2016 18:58:28 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 07 Jun 2016 09:58:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,434,1459839600"; d="scan'208";a="970755835" Received: from sivswdev03.ir.intel.com (HELO localhost.localdomain) ([10.237.217.157]) by orsmga001.jf.intel.com with ESMTP; 07 Jun 2016 09:58:26 -0700 From: Arek Kusztal To: dev@dpdk.org Cc: fiona.trahe@intel.com, john.griffin@intel.com, deepak.k.jain@intel.com, Arek Kusztal Date: Tue, 7 Jun 2016 17:58:13 +0100 Message-Id: <1465318694-20727-2-git-send-email-arkadiuszx.kusztal@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1465318694-20727-1-git-send-email-arkadiuszx.kusztal@intel.com> References: <1465318694-20727-1-git-send-email-arkadiuszx.kusztal@intel.com> Subject: [dpdk-dev] [PATCH 1/2] qat: add aad_len variable to avoid GCC break strict-aliasing rules warning X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jun 2016 16:58:28 -0000 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 --- drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 bcccdf4..a5210d2 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,12 @@ 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; -- 2.1.0