Hi Akhil,

Thanks for the review, comments inline.

Regards,
Fan

> -----Original Message-----
> From: Akhil Goyal [mailto:akhil.go...@nxp.com]
> Sent: Friday, July 5, 2019 2:28 PM
> To: Zhang, Roy Fan <roy.fan.zh...@intel.com>; dev@dpdk.org
> Subject: RE: [PATCH] crypto/mvsam: fix missed code change for mvsam
> 
> Hi Fan,
> 
> >
...
> Extra blank spaces.

Will change in v2. 

> 

...

> > -   sess->sam_sess_params.cipher_key = aead_xform->aead.key.data;
> > +   aead_key = malloc(aead_xform->aead.key.length);
> > +   if (aead_key == NULL) {
> > +           MRVL_LOG(ERR, "Insufficient memory!");
> > +           return -ENOMEM;
> > +   }
> > +
> > +   memcpy(aead_key, aead_xform->aead.key.data,
> > +                   aead_xform->aead.key.length);
> > +
> > +   sess->sam_sess_params.cipher_key = aead_key;
> >     sess->sam_sess_params.cipher_key_len = aead_xform-
> > >aead.key.length;
> >
> >     if (sess->sam_sess_params.cipher_mode == SAM_CIPHER_GCM)
> diff --git
> > a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
> > b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
> > index f6bf2cd4c..b334c7694 100644
> > --- a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
> > +++ b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c
> > @@ -751,6 +751,8 @@


> >
> > +   /* free the keys memory allocated for session creation */
> > +   if (mrvl_sess->sam_sess_params.cipher_key != NULL)
> > +           free(mrvl_sess->sam_sess_params.cipher_key);
> > +   if (mrvl_sess->sam_sess_params.auth_key != NULL)
> > +           free(mrvl_sess->sam_sess_params.auth_key);
> > +
> > +
> Extra blank and missing the aead key free.

During the session config the driver used cipher_key field to store the aead 
key. So no matter it is cipher key or aead key the memory is freed here.
Will fix the extra blank line in v2.

> 
> 
> >     return 0;
> >  }
> >
> > --
> > 2.14.5

Reply via email to