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: <20250702072008.468371-1-ming.li@zohomail.com>
Date: Wed,  2 Jul 2025 15:20:06 +0800
From: Li Ming <ming.li@...omail.com>
To: akpm@...ux-foundation.org,
	andriy.shevchenko@...ux.intel.com,
	bhelgaas@...gle.com,
	ilpo.jarvinen@...ux.intel.com,
	dave@...olabs.net,
	jonathan.cameron@...wei.com,
	dave.jiang@...el.com,
	alison.schofield@...el.com,
	vishal.l.verma@...el.com,
	ira.weiny@...el.com,
	dan.j.williams@...el.com,
	shiju.jose@...wei.com
Cc: linux-cxl@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Li Ming <ming.li@...omail.com>
Subject: [PATCH v2 1/3] resource: Introduce a new helper resource_contains_addr()

In CXL subsystem, many functions need to check an address availability
by checking if the resource range contains the address. Providing a new
helper function resource_contains_addr() to check if the resource range
contains the input address.

Suggested-by: Alison Schofield <alison.schofield@...el.com>
Signed-off-by: Li Ming <ming.li@...omail.com>
---
v2:
* Implement a general helper resource_contains_addr(). (Alison)

base-commit: 0a46f60a9fe16f5596b6b4b3ee1a483ea7854136 cxl/fixes
---
 include/linux/ioport.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index e8b2d6aa4013..75f5e9ccd549 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -308,6 +308,14 @@ static inline bool resource_contains(const struct resource *r1, const struct res
 	return r1->start <= r2->start && r1->end >= r2->end;
 }
 
+/* True if res contains addr */
+static inline bool resource_contains_addr(const struct resource *res, const resource_size_t addr)
+{
+	if (res->flags & IORESOURCE_UNSET)
+		return false;
+	return res->start <= addr && addr <= res->end;
+}
+
 /* True if any part of r1 overlaps r2 */
 static inline bool resource_overlaps(const struct resource *r1, const struct resource *r2)
 {
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ