[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y0/38zsvEgShWjLw@casper.infradead.org>
Date: Wed, 19 Oct 2022 14:13:23 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Tuo Cao <91tuocao@...il.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm: folio-compat: fix bug for pagecache_get_page
On Tue, Oct 18, 2022 at 01:48:34PM -0700, Andrew Morton wrote:
> On Tue, 18 Oct 2022 15:39:39 +0100 Matthew Wilcox <willy@...radead.org> wrote:
>
> > On Tue, Oct 18, 2022 at 10:36:39PM +0800, Tuo Cao wrote:
> > > The folio returned from __filemap_get_folio may be a NULL, it will
> > > causes the kernel crash when access folio->page.
> >
> > This is not a bug. &folio->page does not dereference folio but performs
> > pointer arithmetic.
>
> This is the third attempt to "fix" this. So far. I think we should
> take the hint and make the check for a null pointer more explicit.
I think it's doing a great job of pointing out how many alleged
kernel programmers don't actually understand C and aren't capable of
searching mailing lists to see if somebody else already sent a patch.
Hopefully somebody's keeping track and is feeding this information into
their hiring algorithms.
The real solution is to convert all the callers of pagecache_get_page()
to use folios, and then we can delete this code. I have a small series
in progress. The amount of text savings is immense; half a kilobyte
from one conversion alone. Our compound_head() has got very bloated.
Powered by blists - more mailing lists