* [PATCH 1/2] crypto/dpaa_sec: improve the error checking @ 2018-04-05 8:35 Hemant Agrawal 2018-04-05 8:35 ` [PATCH 2/2] crypto/dpaa2_sec: improve error handling Hemant Agrawal 2018-04-16 9:13 ` [PATCH 1/2] crypto/dpaa_sec: improve the error checking Akhil Goyal 0 siblings, 2 replies; 6+ messages in thread From: Hemant Agrawal @ 2018-04-05 8:35 UTC (permalink / raw) To: dev; +Cc: pablo.de.lara.guarch, akhil.goyal, dpdk-up From: Sunil Kumar Kori <sunil.kori@nxp.com> Reported by NXP's internal coverity Signed-off-by: Sunil Kumar Kori <sunil.kori@nxp.com> --- drivers/crypto/dpaa_sec/dpaa_sec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index c5191ce..79ccb22 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -388,7 +388,7 @@ static int dpaa_sec_prep_cdb(dpaa_sec_session *ses) { struct alginfo alginfo_c = {0}, alginfo_a = {0}, alginfo = {0}; - uint32_t shared_desc_len = 0; + int32_t shared_desc_len = 0; struct sec_cdb *cdb = &ses->cdb; int err; #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN @@ -530,6 +530,12 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses) ses->digest_length, ses->dir); } } + + if (shared_desc_len < 0) { + PMD_TX_LOG(ERR, "error in preparing command block\n"); + return shared_desc_len; + } + cdb->sh_hdr.hi.field.idlen = shared_desc_len; cdb->sh_hdr.hi.word = rte_cpu_to_be_32(cdb->sh_hdr.hi.word); cdb->sh_hdr.lo.word = rte_cpu_to_be_32(cdb->sh_hdr.lo.word); -- 2.7.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] crypto/dpaa2_sec: improve error handling 2018-04-05 8:35 [PATCH 1/2] crypto/dpaa_sec: improve the error checking Hemant Agrawal @ 2018-04-05 8:35 ` Hemant Agrawal 2018-04-16 9:14 ` Akhil Goyal 2018-04-16 9:13 ` [PATCH 1/2] crypto/dpaa_sec: improve the error checking Akhil Goyal 1 sibling, 1 reply; 6+ messages in thread From: Hemant Agrawal @ 2018-04-05 8:35 UTC (permalink / raw) To: dev; +Cc: pablo.de.lara.guarch, akhil.goyal, dpdk-up From: Sunil Kumar Kori <sunil.kori@nxp.com> Fixed as reported by NXP's internal coverity. Also part of dpdk coverity. Coverity issue: 268331 Coverity issue: 268333 Signed-off-by: Sunil Kumar Kori <sunil.kori@nxp.com> --- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index 23012e3..d02d821 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -1627,7 +1627,7 @@ dpaa2_sec_auth_init(struct rte_cryptodev *dev, { struct dpaa2_sec_dev_private *dev_priv = dev->data->dev_private; struct alginfo authdata; - unsigned int bufsize, i; + int bufsize, i; struct ctxt_priv *priv; struct sec_flow_context *flc; @@ -1723,6 +1723,10 @@ dpaa2_sec_auth_init(struct rte_cryptodev *dev, bufsize = cnstr_shdsc_hmac(priv->flc_desc[DESC_INITFINAL].desc, 1, 0, &authdata, !session->dir, session->digest_length); + if (bufsize < 0) { + DPAA2_SEC_ERR("Crypto: Invalid buffer length"); + goto error_out; + } flc->word1_sdl = (uint8_t)bufsize; flc->word2_rflc_31_0 = lower_32_bits( @@ -1753,7 +1757,7 @@ dpaa2_sec_aead_init(struct rte_cryptodev *dev, struct dpaa2_sec_aead_ctxt *ctxt = &session->ext_params.aead_ctxt; struct dpaa2_sec_dev_private *dev_priv = dev->data->dev_private; struct alginfo aeaddata; - unsigned int bufsize, i; + int bufsize, i; struct ctxt_priv *priv; struct sec_flow_context *flc; struct rte_crypto_aead_xform *aead_xform = &xform->aead; @@ -1844,6 +1848,11 @@ dpaa2_sec_aead_init(struct rte_cryptodev *dev, priv->flc_desc[0].desc, 1, 0, &aeaddata, session->iv.length, session->digest_length); + if (bufsize < 0) { + DPAA2_SEC_ERR("Crypto: Invalid buffer length"); + goto error_out; + } + flc->word1_sdl = (uint8_t)bufsize; flc->word2_rflc_31_0 = lower_32_bits( (size_t)&(((struct dpaa2_sec_qp *) @@ -1873,7 +1882,7 @@ dpaa2_sec_aead_chain_init(struct rte_cryptodev *dev, struct dpaa2_sec_aead_ctxt *ctxt = &session->ext_params.aead_ctxt; struct dpaa2_sec_dev_private *dev_priv = dev->data->dev_private; struct alginfo authdata, cipherdata; - unsigned int bufsize, i; + int bufsize, i; struct ctxt_priv *priv; struct sec_flow_context *flc; struct rte_crypto_cipher_xform *cipher_xform; @@ -2065,6 +2074,10 @@ dpaa2_sec_aead_chain_init(struct rte_cryptodev *dev, ctxt->auth_only_len, session->digest_length, session->dir); + if (bufsize < 0) { + DPAA2_SEC_ERR("Crypto: Invalid buffer length"); + goto error_out; + } } else { DPAA2_SEC_ERR("Hash before cipher not supported"); goto error_out; @@ -2156,7 +2169,7 @@ dpaa2_sec_set_ipsec_session(struct rte_cryptodev *dev, struct ipsec_encap_pdb encap_pdb; struct ipsec_decap_pdb decap_pdb; struct alginfo authdata, cipherdata; - unsigned int bufsize; + int bufsize; struct sec_flow_context *flc; PMD_INIT_FUNC_TRACE(); @@ -2346,6 +2359,12 @@ dpaa2_sec_set_ipsec_session(struct rte_cryptodev *dev, 1, 0, &decap_pdb, &cipherdata, &authdata); } else goto out; + + if (bufsize < 0) { + DPAA2_SEC_ERR("Crypto: Invalid buffer length"); + goto out; + } + flc->word1_sdl = (uint8_t)bufsize; /* Enable the stashing control bit */ -- 2.7.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] crypto/dpaa2_sec: improve error handling 2018-04-05 8:35 ` [PATCH 2/2] crypto/dpaa2_sec: improve error handling Hemant Agrawal @ 2018-04-16 9:14 ` Akhil Goyal 2018-04-17 14:42 ` De Lara Guarch, Pablo 0 siblings, 1 reply; 6+ messages in thread From: Akhil Goyal @ 2018-04-16 9:14 UTC (permalink / raw) To: Hemant Agrawal, dev; +Cc: pablo.de.lara.guarch, dpdk-up On 4/5/2018 2:05 PM, Hemant Agrawal wrote: > From: Sunil Kumar Kori <sunil.kori@nxp.com> > > Fixed as reported by NXP's internal coverity. > Also part of dpdk coverity. > > Coverity issue: 268331 > Coverity issue: 268333 > > Signed-off-by: Sunil Kumar Kori <sunil.kori@nxp.com> > --- Acked-by: Akhil Goyal <akhil.goyal@nxp.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] crypto/dpaa2_sec: improve error handling 2018-04-16 9:14 ` Akhil Goyal @ 2018-04-17 14:42 ` De Lara Guarch, Pablo 0 siblings, 0 replies; 6+ messages in thread From: De Lara Guarch, Pablo @ 2018-04-17 14:42 UTC (permalink / raw) To: Akhil Goyal, Hemant Agrawal, dev; +Cc: dpdk-up > -----Original Message----- > From: Akhil Goyal [mailto:akhil.goyal@nxp.com] > Sent: Monday, April 16, 2018 10:15 AM > To: Hemant Agrawal <hemant.agrawal@nxp.com>; dev@dpdk.org > Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; dpdk- > up@NXP1.onmicrosoft.com > Subject: Re: [PATCH 2/2] crypto/dpaa2_sec: improve error handling > > On 4/5/2018 2:05 PM, Hemant Agrawal wrote: > > From: Sunil Kumar Kori <sunil.kori@nxp.com> > > > > Fixed as reported by NXP's internal coverity. > > Also part of dpdk coverity. > > > > Coverity issue: 268331 > > Coverity issue: 268333 > > > > Signed-off-by: Sunil Kumar Kori <sunil.kori@nxp.com> > > --- > Acked-by: Akhil Goyal <akhil.goyal@nxp.com> Added Fixes line and CC'd stable. Applied to dpdk-next-crypto. Thanks, Pablo ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] crypto/dpaa_sec: improve the error checking 2018-04-05 8:35 [PATCH 1/2] crypto/dpaa_sec: improve the error checking Hemant Agrawal 2018-04-05 8:35 ` [PATCH 2/2] crypto/dpaa2_sec: improve error handling Hemant Agrawal @ 2018-04-16 9:13 ` Akhil Goyal 2018-04-17 14:42 ` De Lara Guarch, Pablo 1 sibling, 1 reply; 6+ messages in thread From: Akhil Goyal @ 2018-04-16 9:13 UTC (permalink / raw) To: Hemant Agrawal, dev; +Cc: pablo.de.lara.guarch, dpdk-up On 4/5/2018 2:05 PM, Hemant Agrawal wrote: > From: Sunil Kumar Kori <sunil.kori@nxp.com> > > Reported by NXP's internal coverity > > Signed-off-by: Sunil Kumar Kori <sunil.kori@nxp.com> > --- > drivers/crypto/dpaa_sec/dpaa_sec.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > Acked-by: Akhil Goyal <akhil.goyal@nxp.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] crypto/dpaa_sec: improve the error checking 2018-04-16 9:13 ` [PATCH 1/2] crypto/dpaa_sec: improve the error checking Akhil Goyal @ 2018-04-17 14:42 ` De Lara Guarch, Pablo 0 siblings, 0 replies; 6+ messages in thread From: De Lara Guarch, Pablo @ 2018-04-17 14:42 UTC (permalink / raw) To: Akhil Goyal, Hemant Agrawal, dev; +Cc: dpdk-up, stable > -----Original Message----- > From: Akhil Goyal [mailto:akhil.goyal@nxp.com] > Sent: Monday, April 16, 2018 10:14 AM > To: Hemant Agrawal <hemant.agrawal@nxp.com>; dev@dpdk.org > Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; dpdk- > up@NXP1.onmicrosoft.com > Subject: Re: [PATCH 1/2] crypto/dpaa_sec: improve the error checking > > On 4/5/2018 2:05 PM, Hemant Agrawal wrote: > > From: Sunil Kumar Kori <sunil.kori@nxp.com> > > > > Reported by NXP's internal coverity > > > > Signed-off-by: Sunil Kumar Kori <sunil.kori@nxp.com> > > --- > > drivers/crypto/dpaa_sec/dpaa_sec.c | 8 +++++++- > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > Acked-by: Akhil Goyal <akhil.goyal@nxp.com> Added Fixes line and CC'd stable. Applied to dpdk-next-crypto. Thanks, Pablo ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-04-17 14:43 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-04-05 8:35 [PATCH 1/2] crypto/dpaa_sec: improve the error checking Hemant Agrawal 2018-04-05 8:35 ` [PATCH 2/2] crypto/dpaa2_sec: improve error handling Hemant Agrawal 2018-04-16 9:14 ` Akhil Goyal 2018-04-17 14:42 ` De Lara Guarch, Pablo 2018-04-16 9:13 ` [PATCH 1/2] crypto/dpaa_sec: improve the error checking Akhil Goyal 2018-04-17 14:42 ` De Lara Guarch, Pablo
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.