mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
tools: use __pa() in virt_to_phys()
With 32-bit pointers and a 64-bit phys_addr_t, GCC warns about the pointer-to-integer cast in virt_to_phys(). It can also sign-extend pointers whose top bit is set, turning 0x80000000 into 0xffffffff80000000. Use __pa() to convert through unsigned long before widening the result. This preserves the unsigned pointer value and matches the other address conversion helpers. Reported-by: Mike Rapoport <rppt@kernel.org> Link: https://lore.kernel.org/r/179007180279.508753.4595268983388589280.b4-review@b4 Assisted-by: LLM Signed-off-by: Tianyi Chen <hi@tychen.cc> Link: https://patch.msgid.link/20260923023126.1910311-4-hi@tychen.cc Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
This commit is contained in:
parent
6957416ae4
commit
a10f3a08d2
|
|
@ -30,7 +30,7 @@ static inline void *phys_to_virt(unsigned long address)
|
|||
#define virt_to_phys virt_to_phys
|
||||
static inline phys_addr_t virt_to_phys(volatile void *address)
|
||||
{
|
||||
return (phys_addr_t)address;
|
||||
return __pa(address);
|
||||
}
|
||||
|
||||
static inline void totalram_pages_inc(void)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user