From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 494888EA1 for ; Sat, 30 Jan 2016 14:10:06 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 30 Jan 2016 05:10:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,370,1449561600"; d="scan'208";a="737141923" Received: from dwdohert-dpdk.ir.intel.com ([163.33.213.167]) by orsmga003.jf.intel.com with ESMTP; 30 Jan 2016 05:10:05 -0800 From: Declan Doherty To: dev@dpdk.org Date: Sat, 30 Jan 2016 13:08:31 +0000 Message-Id: <1454159311-5924-1-git-send-email-declan.doherty@intel.com> X-Mailer: git-send-email 2.5.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] aesni_mb: strict-aliasing rule compilation fix 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: Sat, 30 Jan 2016 13:10:06 -0000 When compiling the AESNI_MB PMD with GCC on Centos 6 a "dereferencing pointer ‘obj_p’ does break strict-aliasing rules" warning occurs in the get_session() function. This patch fixes this build warning. Signed-off-by: Declan Doherty --- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c index d8ccf05..18ce176 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c @@ -299,7 +299,7 @@ aesni_mb_set_session_parameters(const struct aesni_mb_ops *mb_ops, static struct aesni_mb_session * get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *crypto_op) { - struct aesni_mb_session *sess; + struct aesni_mb_session *sess = NULL; if (crypto_op->type == RTE_CRYPTO_OP_WITH_SESSION) { if (unlikely(crypto_op->session->type != @@ -308,16 +308,19 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *crypto_op) sess = (struct aesni_mb_session *)crypto_op->session->_private; } else { - struct rte_cryptodev_session *c_sess = NULL; + void *_sess = NULL; - if (rte_mempool_get(qp->sess_mp, (void **)&c_sess)) + if (rte_mempool_get(qp->sess_mp, (void **)&_sess)) return NULL; - sess = (struct aesni_mb_session *)c_sess->_private; + sess = (struct aesni_mb_session *) + ((struct rte_cryptodev_session *)_sess)->_private; if (unlikely(aesni_mb_set_session_parameters(qp->ops, - sess, crypto_op->xform) != 0)) - return NULL; + sess, crypto_op->xform) != 0)) { + rte_mempool_put(qp->sess_mp, _sess); + sess = NULL; + } } return sess; -- 2.5.0