[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALxtO0m1R0kf5Am+oEPAgqommQph9zs6+xfTM0GzGHV+YEXT3Q@mail.gmail.com>
Date: Fri, 17 Oct 2025 14:30:39 +0530
From: Pavitrakumar Managutte <pavitrakumarm@...avyalabs.com>
To: Markus Elfring <Markus.Elfring@....de>
Cc: Bhoomika Kadabi <bhoomikak@...avyalabs.com>,
Manjunath Hadli <manjunath.hadli@...avyalabs.com>, Ruud Derwig <Ruud.Derwig@...opsys.com>,
linux-crypto@...r.kernel.org, devicetree@...r.kernel.org,
Herbert Xu <herbert@...dor.apana.org.au>, Rob Herring <robh@...nel.org>,
LKML <linux-kernel@...r.kernel.org>, Aditya Kulkarni <adityak@...avyalabs.com>,
Conor Dooley <conor+dt@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, T Pratham <t-pratham@...com>
Subject: Re: [PATCH v7 2/4] Add SPAcc ahash support
Hi Markus,
My comments are embedded below.
Warm regards,
PK
On Fri, Oct 17, 2025 at 12:13 AM Markus Elfring <Markus.Elfring@....de> wrote:
>
> …
> > +++ b/drivers/crypto/dwc-spacc/spacc_ahash.c
> > @@ -0,0 +1,980 @@
> …
> > +static int do_shash(struct device *dev, unsigned char *name,
> …
> > +{
> …
> > + sdesc = kmalloc(size, GFP_KERNEL);
> > + if (!sdesc) {
> > + rc = -ENOMEM;
> > + goto do_shash_err;
> > + }
> …
> > +do_shash_err:
> > + crypto_free_shash(hash);
> > + kfree(sdesc);
> > +
> > + return rc;
> > +}
> …
>
> * You may use an additional label for better exception handling.
PK: Ack, I will go with an additional label.
>
> Or
>
> * Would you like to benefit more from the attribute “__free(kfree)”?
> https://elixir.bootlin.com/linux/v6.17.1/source/include/linux/slab.h#L476
>
>
> …
> > +/* Crypto engine hash operation */
> > +static int spacc_hash_do_one_request(struct crypto_engine *engine, void *areq)
> > +{
> …
> > + tctx->tmp_sgl = kmalloc(sizeof(*tctx->tmp_sgl) * 2, GFP_KERNEL);
> > +
> > + if (!tctx->tmp_sgl)
>
> * Please omit a blank line between such statements.
PK: Ack, will do the cleanup in code.
>
> * Can a kmalloc_array() call be helpful here?
PK: Ack, added
>
>
> …
> > + kfree(tctx->tmp_sgl);
> > + tctx->tmp_sgl = NULL;
> > + local_bh_disable();
> > + crypto_finalize_hash_request(engine, req, rc);
> > + local_bh_enable();
> > + return 0;
> > + }
> …
>
> Please avoid duplicate source code in such a function implementation.
PK:Sure, will fix that
>
> Regards,
> Markus
Powered by blists - more mailing lists