Commit 53f45f04 authored by Breno Leitao's avatar Breno Leitao Committed by Will Deacon
Browse files

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: default avatarBreno Leitao <leitao@debian.org>
Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent f22c81be
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -24,7 +24,8 @@ void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
		return NULL;

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

	/*