lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fe4d7cd9-0566-4d1b-97c0-91cc1f952077@web.de>
Date: Thu, 16 Oct 2025 20:43:22 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Bhoomika Kadabi <bhoomikak@...avyalabs.com>,
 Manjunath Hadli <manjunath.hadli@...avyalabs.com>,
 Pavitrakumar Managutte <pavitrakumarm@...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>
Cc: 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

…
> +++ 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.

  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.

* Can a kmalloc_array() call be helpful here?


…
> +			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.

Regards,
Markus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ