From: Matthew Wilcox <willy@infradead.org>
To: Tal Zussman <tz2294@columbia.edu>
Cc: Ilya Dryomov <idryomov@gmail.com>,
Alex Markuze <amarkuze@redhat.com>,
Viacheslav Dubeyko <slava@dubeyko.com>, Jan Kara <jack@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>, Zi Yan <ziy@nvidia.com>,
ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH v2 08/10] ceph: convert page cleanup loop in writepages_finish() to folios
Date: Wed, 5 Aug 2026 00:53:14 +0100 [thread overview]
Message-ID: <anJ7am6p8iDi-wmT@casper.infradead.org> (raw)
In-Reply-To: <c0cc3539-be7d-47e0-82b7-9d7239c37907@columbia.edu>
On Wed, Aug 05, 2026 at 02:33:34AM +0300, Tal Zussman wrote:
> > for (j = 0; j < num_pages; j++) {
> > + struct folio *folio;
> > +
> > fscrypt_finalize_bounce_page(&osd_data->pages[j]);
> > - page = osd_data->pages[j];
> > - BUG_ON(!page);
> > - WARN_ON(!PageUptodate(page));
> > + folio = page_folio(osd_data->pages[j]);
> > + BUG_ON(!folio);
> > + WARN_ON(!folio_test_uptodate(folio));
>
> Sashiko complains:
>
> "Since page_folio() invokes _compound_head() which dereferences the page
> pointer, won't this cause a NULL pointer dereference before reaching the
> BUG_ON(!folio) check if osd_data->pages[j] is actually NULL?
> The previous code checked the page pointer before any dereference occurred.
> Would it be safer to check the array element for NULL before passing it to
> page_folio()?"
>
> The BUG_ON can just be removed, as fscrypt_finalize_bounce_page() cannot take
> or set its argument to NULL as constructed, so the check was unnecessary
> to begin with.
Heh, Sashiko beat me to it ;-)
I'd agree, the BUG_ON was always unnecessary, and I was going to
recommend just deleting it.
next prev parent reply other threads:[~2026-08-04 23:53 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 18:52 [PATCH v2 00/10] ceph: convert writeback path to folios Tal Zussman
2026-08-04 18:52 ` [PATCH v2 01/10] ceph: add ceph_folio_snap_context() Tal Zussman
2026-08-04 19:59 ` Zi Yan
2026-08-04 23:42 ` Matthew Wilcox
2026-08-04 18:52 ` [PATCH v2 02/10] ceph: convert ceph_wait_until_current_writes_complete() to folios Tal Zussman
2026-08-04 18:52 ` [PATCH v2 03/10] mm: remove wait_on_page_writeback() Tal Zussman
2026-08-04 18:52 ` [PATCH v2 04/10] ceph: convert get_writepages_data_length() to folios Tal Zussman
2026-08-04 18:52 ` [PATCH v2 05/10] ceph: convert ceph_submit_write() " Tal Zussman
2026-08-06 18:58 ` Tal Zussman
2026-08-06 19:51 ` Tal Zussman
2026-08-04 18:52 ` [PATCH v2 06/10] mm: remove thp_size() and thp_order() Tal Zussman
2026-08-06 11:55 ` David Hildenbrand (Arm)
2026-08-04 18:52 ` [PATCH v2 07/10] ceph: remove page remnants from write_folio_nounlock() Tal Zussman
2026-08-04 18:52 ` [PATCH v2 08/10] ceph: convert page cleanup loop in writepages_finish() to folios Tal Zussman
2026-08-04 23:33 ` Tal Zussman
2026-08-04 23:53 ` Matthew Wilcox [this message]
2026-08-04 18:52 ` [PATCH v2 09/10] ceph: remove ceph_fscrypt_pagecache_page() and ceph_fscrypt_page_offset() Tal Zussman
2026-08-04 18:52 ` [PATCH v2 10/10] ceph: rename ceph_check_page_before_write() to ceph_check_folio_before_write() Tal Zussman
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=anJ7am6p8iDi-wmT@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=amarkuze@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=david@kernel.org \
--cc=idryomov@gmail.com \
--cc=jack@suse.cz \
--cc=liam@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=slava@dubeyko.com \
--cc=surenb@google.com \
--cc=tz2294@columbia.edu \
--cc=vbabka@kernel.org \
--cc=ziy@nvidia.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