Fix the arm64 linear map range detection for tagged addresses and
replace the bitwise operations with subtract (virt_addr_valid(), __is_lm_address(), __lm_to_phys()). -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE5RElWfyWxS+3PLO2a9axLQDIXvEFAmAa7n0ACgkQa9axLQDI XvG9vQ/9GQTeBKkwgZOmFLKUm2yEFjP9/WU/P3VpBd5T3RwlKe4mtNxozYjWhT4U /7LCl6j0sOkhn8sLmkj2givZS1g4gFuh2UeqxblDY4XuiW6KLyyfRFSwXi7pUO/u tbaW7Q+itTd4GYxqVuz+VKd3Z0Mt6OulYrmdjInWBk413nJ/Gzutoo04PE/hFpXm +lrmgZ1bR3hdGoWVSQ+OmbT0W5nVVKxXo+FdM65dotpbwe3uuVLH7lUBD3C0QxP1 MyJSc2SCdNhrRSKR6Xive7DqKfz6lfYE3oc2C0O6UF+UnekR4XrrgfU40raJqgBd pwWf5BjSh6nSCw5LxfzUcobRo9WjLK0w7HxCYVKCF0uMU27rOgL+/AplcQEhiwRv VVuEnvFT7v5hWbXgU/bAzpIiEzsLuwYXHVnHUawM8xL0wfBhXr1TLJPTdCbg4UrR TgtDFtOYzxLffImMTH9zCCgxvvHiUCkcwCWpYa1uEMh1C7I6jOHba04ABhAjh+bT yF7aG2OmbmjjHXLGCWcQBpIvrCDmHA9I0UctSDwWxYjYVY3fSb4dsmu6Zxbz1WLZ PjeI+ji8qU15DWdy4DP9fByWwuLjctiGP15ay009RTV0hh3AXtKjTOG80dOC+KqB aPCkscbZOhrpFZJHQxx7mbDNxlIvnRDMUMk+2ekEvs/fZARlIYU= =mwnv -----END PGP SIGNATURE----- Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux Pull arm64 fixes from Catalin Marinas: "Fix the arm64 linear map range detection for tagged addresses and replace the bitwise operations with subtract (virt_addr_valid(), __is_lm_address(), __lm_to_phys())" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: Use simpler arithmetics for the linear map macros arm64: Do not pass tagged addresses to __is_lm_address()
This commit is contained in:
@ -251,9 +251,9 @@ static inline const void *__tag_set(const void *addr, u8 tag)
|
||||
* lives in the [PAGE_OFFSET, PAGE_END) interval at the bottom of the
|
||||
* kernel's TTBR1 address range.
|
||||
*/
|
||||
#define __is_lm_address(addr) (((u64)(addr) ^ PAGE_OFFSET) < (PAGE_END - PAGE_OFFSET))
|
||||
#define __is_lm_address(addr) (((u64)(addr) - PAGE_OFFSET) < (PAGE_END - PAGE_OFFSET))
|
||||
|
||||
#define __lm_to_phys(addr) (((addr) & ~PAGE_OFFSET) + PHYS_OFFSET)
|
||||
#define __lm_to_phys(addr) (((addr) - PAGE_OFFSET) + PHYS_OFFSET)
|
||||
#define __kimg_to_phys(addr) ((addr) - kimage_voffset)
|
||||
|
||||
#define __virt_to_phys_nodebug(x) ({ \
|
||||
@ -332,7 +332,7 @@ static inline void *phys_to_virt(phys_addr_t x)
|
||||
#endif /* !CONFIG_SPARSEMEM_VMEMMAP || CONFIG_DEBUG_VIRTUAL */
|
||||
|
||||
#define virt_addr_valid(addr) ({ \
|
||||
__typeof__(addr) __addr = addr; \
|
||||
__typeof__(addr) __addr = __tag_reset(addr); \
|
||||
__is_lm_address(__addr) && pfn_valid(virt_to_pfn(__addr)); \
|
||||
})
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
phys_addr_t __virt_to_phys(unsigned long x)
|
||||
{
|
||||
WARN(!__is_lm_address(x),
|
||||
WARN(!__is_lm_address(__tag_reset(x)),
|
||||
"virt_to_phys used for non-linear address: %pK (%pS)\n",
|
||||
(void *)x,
|
||||
(void *)x);
|
||||
|
Reference in New Issue
Block a user