mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: linux-crypto@vger.kernel.org, kernel-janitors@vger.kernel.org,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Peter Zijlstra <peterz@infradead.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	kernel test robot <lkp@intel.com>,
	oe-kbuild-all@lists.linux.dev
Subject: [PATCH v2 RESEND] crypto: lib/mpi - Extend support for scope-based resource management
Date: Sat, 5 Oct 2024 08:27:03 +0200	[thread overview]
Message-ID: <9ddc71e7-e98a-4fa8-b140-4035dd2874b6@web.de> (raw)
In-Reply-To: <ZwDPp4bU1J5uEgQe@gondor.apana.org.au>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 18 Sep 2024 11:06:35 +0200

Scope-based resource management became supported for some
programming interfaces by contributions of Peter Zijlstra on 2023-05-26.
See also the commit 54da6a0924311c7cf5015533991e44fb8eb12773 ("locking:
Introduce __cleanup() based infrastructure").

Thus add a macro call so that the attribute “__free(mpi_free)” can be
applied accordingly.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---

V2:
The kernel build service pointed out that the proposed identifier “T_”
was not recognised by the compiler.
Thus reserved identifiers need still be applied also at such a place instead
so far.
I became curious under which circumstances corresponding development concerns
will be reconsidered any more.


 include/linux/mpi.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/linux/mpi.h b/include/linux/mpi.h
index 47be46f36435..6fbcb88ce296 100644
--- a/include/linux/mpi.h
+++ b/include/linux/mpi.h
@@ -19,6 +19,8 @@

 #include <linux/types.h>
 #include <linux/scatterlist.h>
+#include <linux/cleanup.h>
+#include <linux/err.h>

 #define BYTES_PER_MPI_LIMB	(BITS_PER_LONG / 8)
 #define BITS_PER_MPI_LIMB	BITS_PER_LONG
@@ -44,6 +46,8 @@ typedef struct gcry_mpi *MPI;
 /*-- mpiutil.c --*/
 MPI mpi_alloc(unsigned nlimbs);
 void mpi_free(MPI a);
+DEFINE_FREE(mpi_free, MPI, if (!IS_ERR_OR_NULL(_T)) mpi_free(_T))
+
 int mpi_resize(MPI a, unsigned nlimbs);

 MPI mpi_copy(MPI a);
--
2.46.0


  reply	other threads:[~2024-10-05  6:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-17  9:33 [PATCH] " Markus Elfring
2024-09-17 23:27 ` kernel test robot
2024-09-18  9:26   ` [PATCH v2] " Markus Elfring
2024-10-05  5:33     ` Herbert Xu
2024-10-05  6:27       ` Markus Elfring [this message]
2024-10-10  8:40         ` [PATCH v2 RESEND] " Herbert Xu
2024-10-10  8:58           ` [v2] " Markus Elfring
2024-10-10  9:00             ` Herbert Xu
2024-10-10  9:10               ` Markus Elfring
2024-10-12 15:00           ` [PATCH v3 0/3] lib: Extending " Markus Elfring
2024-10-12 15:05             ` [PATCH v3 1/3] crypto: lib/mpi - Extend " Markus Elfring
2024-10-12 15:08             ` [PATCH v3 2/3] lib/digsig: Use scope-based resource management for two MPI variables in digsig_verify_rsa() Markus Elfring
2024-10-15 21:27               ` kernel test robot
2024-10-16 11:21               ` kernel test robot
2024-10-12 15:10             ` [PATCH v3 3/3] lib/digsig: Use scope-based resource management for two " Markus Elfring
2024-09-18  0:52 ` [PATCH] crypto: lib/mpi - Extend support for scope-based resource management kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9ddc71e7-e98a-4fa8-b140-4035dd2874b6@web.de \
    --to=markus.elfring@web.de \
    --cc=herbert@gondor.apana.org.au \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome