* [dpdk-dev] [PATCH] aesni_mb: strict-aliasing rule compilation fix
@ 2016-01-30 13:08 Declan Doherty
2016-02-15 17:06 ` [dpdk-dev] [PATCH v2] " Declan Doherty
0 siblings, 1 reply; 4+ messages in thread
From: Declan Doherty @ 2016-01-30 13:08 UTC (permalink / raw)
To: dev
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 <declan.doherty@intel.com>
---
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [PATCH v2] aesni_mb: strict-aliasing rule compilation fix
2016-01-30 13:08 [dpdk-dev] [PATCH] aesni_mb: strict-aliasing rule compilation fix Declan Doherty
@ 2016-02-15 17:06 ` Declan Doherty
2016-02-16 14:53 ` De Lara Guarch, Pablo
0 siblings, 1 reply; 4+ messages in thread
From: Declan Doherty @ 2016-02-15 17:06 UTC (permalink / raw)
To: dev
Fixes: 924e84f87306 ("aesni_mb: add driver for multi buffer based crypto")
When compiling the AESNI_MB PMD with GCC 4.4.7 on Centos 6.7 a "dereferencing
pointer ‘obj_p’ does break strict-aliasing rules" warning occurs in the
get_session() function.
Signed-off-by: Declan Doherty <declan.doherty@intel.com>
---
Adding "Fixes" details to patch
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH v2] aesni_mb: strict-aliasing rule compilation fix
2016-02-15 17:06 ` [dpdk-dev] [PATCH v2] " Declan Doherty
@ 2016-02-16 14:53 ` De Lara Guarch, Pablo
2016-02-24 14:06 ` Thomas Monjalon
0 siblings, 1 reply; 4+ messages in thread
From: De Lara Guarch, Pablo @ 2016-02-16 14:53 UTC (permalink / raw)
To: Doherty, Declan, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Declan Doherty
> Sent: Monday, February 15, 2016 5:06 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v2] aesni_mb: strict-aliasing rule compilation fix
>
> Fixes: 924e84f87306 ("aesni_mb: add driver for multi buffer based crypto")
>
> When compiling the AESNI_MB PMD with GCC 4.4.7 on Centos 6.7 a
> "dereferencing
> pointer ‘obj_p’ does break strict-aliasing rules" warning occurs in the
> get_session() function.
>
> Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH v2] aesni_mb: strict-aliasing rule compilation fix
2016-02-16 14:53 ` De Lara Guarch, Pablo
@ 2016-02-24 14:06 ` Thomas Monjalon
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2016-02-24 14:06 UTC (permalink / raw)
To: Doherty, Declan; +Cc: dev
> > Fixes: 924e84f87306 ("aesni_mb: add driver for multi buffer based crypto")
> >
> > When compiling the AESNI_MB PMD with GCC 4.4.7 on Centos 6.7 a
> > "dereferencing
> > pointer ‘obj_p’ does break strict-aliasing rules" warning occurs in the
> > get_session() function.
> >
> > Signed-off-by: Declan Doherty <declan.doherty@intel.com>
>
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-02-24 14:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-30 13:08 [dpdk-dev] [PATCH] aesni_mb: strict-aliasing rule compilation fix Declan Doherty
2016-02-15 17:06 ` [dpdk-dev] [PATCH v2] " Declan Doherty
2016-02-16 14:53 ` De Lara Guarch, Pablo
2016-02-24 14:06 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).