linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: Aaron Yang <yangqixiao@inspur.com>
Cc: SeongJae Park <sj@kernel.org>, linux-mm@kvack.org, damon@lists.linux.dev
Subject: Re: [PATCH v2] mm/damon/paddr: initialize 'folio' variables to NULL for safety and clarity
Date: Sun,  4 Jan 2026 15:07:33 -0800	[thread overview]
Message-ID: <20260104230735.67401-1-sj@kernel.org> (raw)
In-Reply-To: <20260104013255.16962-1-yangqixiao@inspur.com>

On Sun,  4 Jan 2026 09:32:55 +0800 Aaron Yang <yangqixiao@inspur.com> wrote:

> In damon_pa_mark_accessed_or_deactivate(), damon_pa_pageout(),
> damon_pa_migrate(), and damon_pa_stat(), the local variable 'folio' is
> declared but not initialized.
> 
> Initialize 'folio' to NULL to:
> - Follow kernel convention: uninitialized pointers should be
>   explicitly NULL

Technically speaking, this is required only if it avoids unsafe code such as
use of the uninitialized pointers.  Because zero-length DAMON region is not
allowed, this is not the main reason of this change that we discussed on v1 of
this patch [1].

> - Improve code readability and maintainability

This is the main goal of this change.  This change allows readers be able to
know the function is safe, without have to know the fact that length DAMON
regions is disallowed.

> - Provide safe fallback (NULL assignment to s->last_applied is harmless
>   and callers check for NULL before dereference)
> 
> Signed-off-by: Aaron Yang <yangqixiao@inspur.com>

Because my above comments are for only clarifications of minor details:

Reviewed-by: SeongJae Park <sj@kernel.org>

> ---

FYI, this is a good place to summarize changes you made from the previous
version.  For more details, please refer to the doc [2].

[1] https://lore.kernel.org/20251231055737.73325-1-yangqixiao@inspur.com
[2] https://origin.kernel.org/doc/html/latest/process/submitting-patches.html#commentary


Thanks,
SJ

[...]


      reply	other threads:[~2026-01-04 23:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-04  1:32 Aaron Yang
2026-01-04 23:07 ` SeongJae Park [this message]

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=20260104230735.67401-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=damon@lists.linux.dev \
    --cc=linux-mm@kvack.org \
    --cc=yangqixiao@inspur.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