From nobody Fri Nov 29 16:40:59 2024 Received: from mout.web.de (mout.web.de [212.227.15.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E201315DBD5; Tue, 17 Sep 2024 09:33:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.15.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726565623; cv=none; b=jkJl2i+54mBbPS7ZonTwvtSSeSybtIN/ID75WGiOBaTToE23o00GnAB/o6h2j5Wh1Q07E7F8kkSFUgY86PIFi/WG6e+3ogP9ML8E+/2nUA87inpsaISCzsrkKOa9Yg39gr4cRE9h7l6DLb6uxWn/UDdhi9UfiwSZedQvCpV44Fg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726565623; c=relaxed/simple; bh=hac2hUFaa/gebLVtfJwTY0SuulzszxQKQH0AilZ+XKk=; h=Message-ID:Date:MIME-Version:To:Cc:From:Subject:Content-Type; b=TyDLaifcpA6Y1knhCBVyLll8PLeif/IPmzSAgz72kIfAkBTUeW7rJOnAXjzVRMP/JfNnti7cvovSXYgHmfPH5XClOh4QSDzPoplT8HnPIe1m4O3lGsO3wNI2njqmRLB9tN95DYpe7StuGPnnIzlaI1HDfvTWUbW6aQkwZ0sDNbk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de; spf=pass smtp.mailfrom=web.de; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b=BeoH2Iy6; arc=none smtp.client-ip=212.227.15.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="BeoH2Iy6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1726565606; x=1727170406; i=markus.elfring@web.de; bh=BQCXTN8kKkd1kkGO9NF/p4jvWGCDLj4NS40vm1F4hUo=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:To:Cc:From: Subject:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=BeoH2Iy6DdIU4GndjNZnbkIeq2YNj+TbY72vkBctTYkViWyETfm032YkQg4aDjm/ dnHEB91Vdg7GgM0aXN8k+BRJCmbj5a82Y8mGIrFcUTCCAuyY/9EavMWuXPqUyzB1Z VRFy4o/bQaqKlG224rPYsAm+oZoqV6f8cOzpwp2X/azvLAyweYX74sXkWinE+9isF vj1T1c/Rkx8a5j2FtJcaRUHlqdBx8K8boeFkHucGEmdAQOa3WQ+aBna4wVJwA+cCM KaDXKfOpDdK/aEEVf46RtVBTaZD3asU51rYbyc5r2w6X8hGlNDrIxg3PpcXZxqhFa gFibUQDQN2Kp8A/f+A== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.85.95]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MLzin-1sYYC72tIP-00XdyW; Tue, 17 Sep 2024 11:33:26 +0200 Message-ID: Date: Tue, 17 Sep 2024 11:33:14 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-GB To: kernel-janitors@vger.kernel.org, Herbert Xu Cc: LKML From: Markus Elfring Subject: [PATCH] crypto: lib/mpi - Extend support for scope-based resource management Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:nL+dVkroubRqlrEYG8b1wBZgrLvmUOOGbIjc8yycZpxoJGL7txJ yJLhnXrJOfhNzXj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set="utf-8" From: Markus Elfring Date: Tue, 17 Sep 2024 11:20:29 +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 =E2=80=9C__free(mpi_free)=E2=80= =9D can be applied accordingly. Signed-off-by: Markus Elfring --- include/linux/mpi.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/mpi.h b/include/linux/mpi.h index 47be46f36435..47db8fa5fcc8 100644 --- a/include/linux/mpi.h +++ b/include/linux/mpi.h @@ -19,6 +19,8 @@ #include #include +#include +#include #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