Thread (15 messages) 15 messages, 5 authors, 2014-01-23

[PATCH 2/6] arm64: Add function to create identity mappings

From: catalin.marinas@arm.com (Catalin Marinas)
Date: 2014-01-22 17:40:04
Also in: linux-efi, lkml

On Fri, Jan 10, 2014 at 10:29:06PM +0000, Mark Salter wrote:
+void __init create_id_mapping(phys_addr_t addr, phys_addr_t size)
+{
+	pgd_t *pgd = &idmap_pg_dir[pgd_index(addr)];
+
+	if (pgd >= &idmap_pg_dir[ARRAY_SIZE(idmap_pg_dir)]) {
+		pr_warn("BUG: not creating id mapping for 0x%016llx\n", addr);
+		return;
+	}
The condition above is always false since pgd_index() already ands the
index with (PTRS_PER_PGD - 1). Better check addr against something like
(PTRS_PER_PGD * PGDIR_SIZE) (for clarity, you could do other shifts,
doesn't really matter).

-- 
Catalin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help