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]
Date:   Fri, 12 May 2023 00:27:21 +0800
From:   Lingxiang Zheng <lxzheng@...il.com>
To:     linux-kernel@...r.kernel.org
Cc:     torvalds@...ux-foundation.org, Lingxiang Zheng <lxzheng@...il.com>
Subject: [PATCH] iomem: Adjust address width for 64-bit addresses

Modify the address width determination in /proc/iomem output to better
handle 64-bit addresses. The previous implementation did not correctly
account for 64-bit address space, as it would limit the address width to 8
hexadecimal characters. This change adjusts the address width according to
the following conditions:

1. If the resource's end address is less than 0x10000, set the width to 4.
2. If the resource's end address is greater than 0xFFFFFFFF, set the width to 16.
3. For other cases, set the width to 8.

Signed-off-by: Lingxiang Zheng <lxzheng@...il.com>
---
 kernel/resource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/resource.c b/kernel/resource.c
index b1763b2fd7ef..d8f977d628f5 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -110,7 +110,7 @@ static int r_show(struct seq_file *m, void *v)
 	struct resource *root = pde_data(file_inode(m->file));
 	struct resource *r = v, *p;
 	unsigned long long start, end;
-	int width = root->end < 0x10000 ? 4 : 8;
+	int width = root->end < 0x10000 ? 4 : root->end > 0xFFFFFFFF ? 16 : 8;
 	int depth;
 
 	for (depth = 0, p = r; depth < MAX_IORES_LEVEL; depth++, p = p->parent)
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ