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 C79BC5424 for ; Fri, 27 Nov 2015 18:45:57 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP; 27 Nov 2015 09:45:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,352,1444719600"; d="scan'208";a="3273091" Received: from dwdohert-dpdk.ir.intel.com ([163.33.213.167]) by fmsmga004.fm.intel.com with ESMTP; 27 Nov 2015 09:45:55 -0800 From: Declan Doherty To: dev@dpdk.org Date: Fri, 27 Nov 2015 17:44:47 +0000 Message-Id: <1448646287-4261-1-git-send-email-declan.doherty@intel.com> X-Mailer: git-send-email 2.5.0 Subject: [dpdk-dev] [PATCH] cryptodev: fixes for gcc 4.4.7 build issues 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: Fri, 27 Nov 2015 17:45:58 -0000 - Fix for build error caused by flexible array member in struct rte_ccryptodev_session. - Change void** casting of sess parameter in rte_cryptodev_session_create which causes a strict-aliasing error Signed-off-by: Declan Doherty --- lib/librte_cryptodev/rte_cryptodev.c | 7 +++++-- lib/librte_cryptodev/rte_cryptodev_pmd.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index edd1320..f09f67e 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -1037,6 +1037,7 @@ rte_cryptodev_session_create(uint8_t dev_id, struct rte_crypto_xform *xform) { struct rte_cryptodev *dev; struct rte_cryptodev_session *sess; + void *_sess; if (!rte_cryptodev_pmd_is_valid_dev(dev_id)) { CDEV_LOG_ERR("Invalid dev_id=%d", dev_id); @@ -1046,11 +1047,13 @@ rte_cryptodev_session_create(uint8_t dev_id, struct rte_crypto_xform *xform) dev = &rte_crypto_devices[dev_id]; /* Allocate a session structure from the session pool */ - if (rte_mempool_get(dev->data->session_pool, (void **)&sess)) { + if (rte_mempool_get(dev->data->session_pool, &_sess)) { CDEV_LOG_ERR("Couldn't get object from session mempool"); return NULL; } + sess = (struct rte_cryptodev_session *)_sess; + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->session_configure, NULL); if (dev->dev_ops->session_configure(dev, xform, sess->_private) == NULL) { @@ -1058,7 +1061,7 @@ rte_cryptodev_session_create(uint8_t dev_id, struct rte_crypto_xform *xform) dev_id); /* Return session to mempool */ - rte_mempool_put(sess->mp, (void *)sess); + rte_mempool_put(sess->mp, _sess); return NULL; } diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h index d5fbe44..8270afa 100644 --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h @@ -76,7 +76,7 @@ struct rte_cryptodev_session { struct rte_mempool *mp; } __rte_aligned(8); - char _private[]; + char _private[0]; }; struct rte_cryptodev_driver; -- 2.5.0