linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
Cc: "Andrey Konovalov" <andreyknvl@gmail.com>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Chinwen Chang" <chinwen.chang@mediatek.com>,
	"Nicholas Tang" <nicholas.tang@mediatek.com>,
	"James Hsu" <James.Hsu@mediatek.com>,
	"Yee Lee" <Yee.Lee@mediatek.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	kasan-dev <kasan-dev@googlegroups.com>,
	kuan-ying.lee@mediatek.com
Subject: Re: [PATCH] kmemleak: fix kmemleak false positive report with HW tag-based kasan enable
Date: Fri, 19 Nov 2021 14:43:59 -0800	[thread overview]
Message-ID: <20211119144359.b70d2fde7631bd14cd9652e3@linux-foundation.org> (raw)
In-Reply-To: <c5cfd0c41dee93cd923762a6e0d61baea52cec8d.camel@mediatek.com>

On Fri, 19 Nov 2021 23:12:55 +0800 Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com> wrote:

> > > > 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.

  reply	other threads:[~2021-11-19 22:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18  5:44 [PATCH] kmemleak: fix kmemleak false positive report with HW tag-based kasan enable Kuan-Ying Lee
2021-11-18  9:20 ` Kuan-Ying Lee
2021-11-19 14:15   ` Andrey Konovalov
2021-11-19 15:12     ` Kuan-Ying Lee
2021-11-19 22:43       ` Andrew Morton [this message]
2021-11-24  2:00         ` Kuan-Ying Lee
2021-11-25 16:13   ` Andrey Konovalov
2021-11-28  0:20     ` Andrew Morton
2021-12-02 18:19 ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211119144359.b70d2fde7631bd14cd9652e3@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=James.Hsu@mediatek.com \
    --cc=Kuan-Ying.Lee@mediatek.com \
    --cc=Yee.Lee@mediatek.com \
    --cc=andreyknvl@gmail.com \
    --cc=catalin.marinas@arm.com \
    --cc=chinwen.chang@mediatek.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nicholas.tang@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).