Skip to content

Commit 591f0e8

Browse files
declanwdThomas Monjalon
authored andcommitted
aesni_mb: fix strict-aliasing compilation rule
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. Fixes: 924e84f ("aesni_mb: add driver for multi buffer based crypto") Signed-off-by: Declan Doherty <declan.doherty@intel.com> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
1 parent a324c45 commit 591f0e8

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ aesni_mb_set_session_parameters(const struct aesni_mb_ops *mb_ops,
298298
static struct aesni_mb_session *
299299
get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *crypto_op)
300300
{
301-
struct aesni_mb_session *sess;
301+
struct aesni_mb_session *sess = NULL;
302302

303303
if (crypto_op->type == RTE_CRYPTO_OP_WITH_SESSION) {
304304
if (unlikely(crypto_op->session->type !=
@@ -307,16 +307,19 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *crypto_op)
307307

308308
sess = (struct aesni_mb_session *)crypto_op->session->_private;
309309
} else {
310-
struct rte_cryptodev_session *c_sess = NULL;
310+
void *_sess = NULL;
311311

312-
if (rte_mempool_get(qp->sess_mp, (void **)&c_sess))
312+
if (rte_mempool_get(qp->sess_mp, (void **)&_sess))
313313
return NULL;
314314

315-
sess = (struct aesni_mb_session *)c_sess->_private;
315+
sess = (struct aesni_mb_session *)
316+
((struct rte_cryptodev_session *)_sess)->_private;
316317

317318
if (unlikely(aesni_mb_set_session_parameters(qp->ops,
318-
sess, crypto_op->xform) != 0))
319-
return NULL;
319+
sess, crypto_op->xform) != 0)) {
320+
rte_mempool_put(qp->sess_mp, _sess);
321+
sess = NULL;
322+
}
320323
}
321324

322325
return sess;

0 commit comments

Comments
 (0)