DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Declan Doherty <declan.doherty@intel.com>
To: dev@dpdk.org
Subject: [PATCH] cryptodev: fixes for gcc 4.4.7 build issues
Date: Fri, 27 Nov 2015 17:44:47 +0000	[thread overview]
Message-ID: <1448646287-4261-1-git-send-email-declan.doherty@intel.com> (raw)

- 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 <declan.doherty@intel.com>
---
 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

             reply	other threads:[~2015-11-27 17:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27 17:44 Declan Doherty [this message]
2015-11-27 18:16 ` [PATCH] cryptodev: fixes for gcc 4.4.7 build issues Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1448646287-4261-1-git-send-email-declan.doherty@intel.com \
    --to=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox