Skip to content

Commit 53f45f0

Browse files
leitaowilldeacon
authored andcommitted
arm64: mm: warn once for ioremap attempts on RAM mappings
Replace WARN_ON with WARN_ONCE when detecting attempts to ioremap RAM. This prevents log spam when a misbehaving driver repeatedly tries to map RAM via ioremap. A single warning is more than enough to show the broken code path, and extra reports don't add extra information. Warning floods have been seen in production environments where broken external drivers hit this code path thousand of times, causing unnecessary messages to be printed and pressure on the serial console. Signed-off-by: Breno Leitao <leitao@debian.org> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Will Deacon <will@kernel.org>
1 parent f22c81b commit 53f45f0

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

arch/arm64/mm/ioremap.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
2424
return NULL;
2525

2626
/* Don't allow RAM to be mapped. */
27-
if (WARN_ON(pfn_is_map_memory(__phys_to_pfn(phys_addr))))
27+
if (WARN_ONCE(pfn_is_map_memory(__phys_to_pfn(phys_addr)),
28+
"ioremap attempted on RAM pfn\n"))
2829
return NULL;
2930

3031
/*

0 commit comments

Comments
 (0)