[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20220328113604.31373-1-xiam0nd.tong@gmail.com>
Date: Mon, 28 Mar 2022 19:36:04 +0800
From: Xiaomeng Tong <xiam0nd.tong@...il.com>
To: sj@...nel.org
Cc: akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, stable@...r.kernel.org, xiam0nd.tong@...il.com
Subject: Re: [PATCH] damon: vaddr-test: fix a missing check on list iterator
On Mon, 28 Mar 2022 07:51:04 +0000, SJ wrote:
> On Sun, 27 Mar 2022 16:03:45 +0800 Xiaomeng Tong <xiam0nd.tong@...il.com> wrote:
>
> > The bug is here:
> > KUNIT_EXPECT_EQ(test, r->ar.start, start + i * expected_width);
> > KUNIT_EXPECT_EQ(test, r->ar.end, end);
> >
> > For the damon_for_each_region(), just like list_for_each_entry(),
> > the list iterator 'drm_crtc' will point to a bogus position
> > containing HEAD if the list is empty or no element is found.
> > This case must be checked before any use of the iterator,
> > otherwise it will lead to a invalid memory access.
>
> We ensure 'damon_va_evenly_split_region()' successes before executing the loop,
> so the issue cannot occur. That said, I think this patch makes code better to
> read. Could you please resend this patch after fixing the commit message?
Yes, you should be right. I have resend this patch with the commit message changed.
Please check it, thank you.
--
Xiaomeng Tong
Powered by blists - more mailing lists