Thread (9 messages) 9 messages, 4 authors, 2021-12-02

Re: [PATCH] kmemleak: fix kmemleak false positive report with HW tag-based kasan enable

From: Andrew Morton <akpm@linux-foundation.org>
Date: 2021-11-19 22:44:07
Also in: linux-mediatek, linux-mm, lkml

On Fri, 19 Nov 2021 23:12:55 +0800 Kuan-Ying Lee [off-list ref] wrote:
quoted
quoted
quoted
Call sequence:
ptr = kmalloc(size, GFP_KERNEL);
page = virt_to_page(ptr);
kfree(page_address(page));
ptr = kmalloc(size, GFP_KERNEL);
How is this call sequence valid? page_address returns the address of
the start of the page, while kmalloced object could have been located
in the middle of it.
Thanks for pointing out. I miss the offset.

It should be listed as below.

ptr = kmalloc(size, GFP_KERNEL);
page = virt_to_page(ptr);
offset = offset_in_page(ptr);
kfree(page_address(page) + offset);
ptr = kmalloc(size, GFP_KERNEL);
I updated the changelog to reflect this.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help