From: Andrew Morton <akpm@linux-foundation.org>
To: Shivank Garg <shivankg@amd.com>
Cc: Dan Carpenter <dan.carpenter@linaro.org>,
oe-kbuild@lists.linux.dev, lkp@intel.com,
oe-kbuild-all@lists.linux.dev,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [linux-next:master 7893/8235] fs/jfs/jfs_metapage.c:245 __metapage_migrate_folio() error: we previously assumed 'mp' could be null (see line 235)
Date: Wed, 7 May 2025 17:34:57 -0700 [thread overview]
Message-ID: <20250507173457.d2c6eb2b92a10fbd4185cf1f@linux-foundation.org> (raw)
In-Reply-To: <21037c25-b85c-48fa-bdac-27cb3be2ccdb@amd.com>
On Wed, 7 May 2025 17:19:52 +0530 Shivank Garg <shivankg@amd.com> wrote:
> This is a false positive.
>
> In metapage_migrate_folio(), it checks if (!src->private) and only calls
> __metapage_migrate_folio() if src->private is non-NULL
>
> static int metapage_migrate_folio(struct address_space *mapping, struct folio *dst,
> struct folio *src, enum migrate_mode mode)
> {
> ...
> if (!src->private)
> return filemap_migrate_folio(mapping, dst, src, mode);
> ...
> ...
> return __metapage_migrate_folio(mapping, dst, src, mode);
> }
>
> Then __metapage_migrate_folio() calls mp = folio_to_mp(src, 0), which returns src->private.
> Which should not be NULL as previously checked.
>
> I think we can skip the mp != NULL check from
> > 39ed4d1a0e03ce Shivank Garg 2025-04-30 @235 if (mp && metapage_locked(mp))
> It seem redundant here.
Yes. Right now the code simply looks wrong:
mp = folio_to_mp(src, 0);
if (mp && metapage_locked(mp))
return -EAGAIN;
...
page_offset = mp->data - folio_address(src);
any reader of this will be worried. A code comment (at least) would
save them concern and time. Reworking the code to eliminate doubt
would be better.
next prev parent reply other threads:[~2025-05-08 0:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-07 11:11 Dan Carpenter
2025-05-07 11:49 ` Shivank Garg
2025-05-08 0:34 ` Andrew Morton [this message]
2025-05-08 5:38 ` Dan Carpenter
2025-05-08 6:48 ` Shivank Garg
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=20250507173457.d2c6eb2b92a10fbd4185cf1f@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dan.carpenter@linaro.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
--cc=shivankg@amd.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