Re: [PATCH v3 3/3] mm: kmemleak: check physical address when scan

From: Catalin Marinas
Date: Sat Jun 11 2022 - 05:46:26 EST


On Sat, Jun 11, 2022 at 11:46:27AM +0800, Patrick Wang wrote:
> I've received an auto build test WARNING from kernel test robot:
>
> mm/kmemleak.c: In function 'scan_object':
> >> arch/powerpc/include/asm/page.h:215:42: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> 215 | #define __va(x) ((void *)(unsigned long)((phys_addr_t)(x) + VIRT_PHYS_OFFSET))
> | ^
> mm/kmemleak.c:1403:19: note: in expansion of macro '__va'
> 1403 | __va((void *)object->pointer) :
> | ^~~~

Ah, yes, arm32 has the same issue with phys_addr_t defined as u64 in
some configurations while long is 32-bit.

> So I will replace __va((void *)object->pointer)
> to __va((phys_addr_t)object->pointer) for fixing this warning,

It makes sense.

--
Catalin