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-next>] [day] [month] [year] [list]
Message-Id: <20240731233145.2485874-1-Frank.Li@nxp.com>
Date: Wed, 31 Jul 2024 19:31:44 -0400
From: Frank Li <Frank.Li@....com>
To: Arnd Bergmann <arnd@...db.de>,
	Jason Gunthorpe <jgg@...pe.ca>,
	Niklas Schnelle <schnelle@...ux.ibm.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Alexei Starovoitov <ast@...nel.org>,
	Kent Overstreet <kent.overstreet@...ux.dev>,
	linux-kernel@...r.kernel.org (open list)
Cc: imx@...ts.linux.dev
Subject: [PATCH 1/1] linux/io.h: Add cleanup defination for iounmap() and memunmap()

Add DEFINE_FREE for iounmap() and memunmap() to support scope based
cleanup.

Signed-off-by: Frank Li <Frank.Li@....com>
---
 include/linux/io.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/io.h b/include/linux/io.h
index 59ec5eea696c4..7695d7973c8ff 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -163,6 +163,9 @@ enum {
 void *memremap(resource_size_t offset, size_t size, unsigned long flags);
 void memunmap(void *addr);
 
+DEFINE_FREE(iounmap, void __iomem *, if (!IS_ERR_OR_NULL(_T)) iounmap(_T))
+DEFINE_FREE(memunmap, void *, if (!IS_ERR_OR_NULL(_T)) memunmap(_T))
+
 /*
  * On x86 PAT systems we have memory tracking that keeps track of
  * the allowed mappings on memory ranges. This tracking works for
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ