path: root/lib/devmem_is_allowed.c
Commit message (Collapse)AuthorAgeFilesLines
* lib: use PFN_PHYS() in devmem_is_allowed()Liang Wang2021-08-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The physical address may exceed 32 bits on 32-bit systems with more than 32 bits of physcial address. Use PFN_PHYS() in devmem_is_allowed(), or the physical address may overflow and be truncated. We found this bug when mapping a high addresses through devmem tool, when CONFIG_STRICT_DEVMEM is enabled on the ARM with ARM_LPAE and devmem is used to map a high address that is not in the iomem address range, an unexpected error indicating no permission is returned. This bug was initially introduced from v2.6.37, and the function was moved to lib in v5.11. Link: Fixes: 087aaffcdf9c ("ARM: implement CONFIG_STRICT_DEVMEM by disabling access to RAM via /dev/mem") Fixes: 527701eda5f1 ("lib: Add a generic version of devmem_is_allowed()") Signed-off-by: Liang Wang <> Reviewed-by: Luis Chamberlain <> Cc: Palmer Dabbelt <> Cc: Greg Kroah-Hartman <> Cc: Russell King <> Cc: Liang Wang <> Cc: Xiaoming Ni <> Cc: Kefeng Wang <> Cc: <> [2.6.37+] Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
* lib: Add a generic version of devmem_is_allowed()Palmer Dabbelt2020-12-111-0/+27
As part of adding support for STRICT_DEVMEM to the RISC-V port, Zong provided a devmem_is_allowed() implementation that's exactly the same as all the others I checked. Instead I'm adding a generic version, which will soon be used. Reviewed-by: Luis Chamberlain <> Signed-off-by: Palmer Dabbelt <>