Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hongfu Li" <lihongfu@kylinos.cn>,
	"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>, "Shuah Khan" <shuah@kernel.org>
Cc: hongfu.li@linux.dev, linux-mm@kvack.org
Subject: Re: [PATCH v2] selftests/mm: mlock2-tests: fix fclose(NULL) in is_vmflag_set()
Date: Sat, 14 Nov 2026 02:53:30 +0000	[thread overview]
Message-ID: <sashiko-outbox-214060@kernel.org> (raw)
In-Reply-To: <20261113-for-mlock2-v2-1-f62195fc8394@kylinos.cn>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] selftests/mm: missing Fixes trailer for fclose(NULL) fix in
  is_vmflag_set()
--

commit 38a7fefcf9bd0b1ed77197eeaab78f5845d74dfd
Author: Hongfu Li <lihongfu@kylinos.cn>

> selftests/mm: mlock2-tests: fix fclose(NULL) in is_vmflag_set()
>
> is_vmflag_set() jumps to the shared 'out' label when
> seek_to_smaps_entry() fails. smaps is NULL on that path, and the
> code at the 'out' label calls fclose(smaps) unconditionally.
> fclose(NULL) is undefined behaviour, so the test crashes before
> it can report a test result.
>
> Return early on that error path instead, so smaps is always valid
> at the 'out' label.
>
> get_value_for_name() follows the same pattern. Return early on the
> seek_to_smaps_entry() error path there as well, and drop the now
> redundant 'if (smaps)' guard on the fclose().
>
> Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>

[Severity: Low]
Since this fixes the fclose(NULL) crash in is_vmflag_set(), should this
include:

  Fixes: b3b0d09c7a23 ("selftests: vm: add tests for lock on fault")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261113-for-mlock2-v2-1-f62195fc8394@kylinos.cn?part=1


  parent reply	other threads:[~2026-11-14  2:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13  2:52 [PATCH v2] selftests/mm: mlock2-tests: fix fclose(NULL) in is_vmflag_set() Hongfu Li
2026-11-13 10:31 ` David Hildenbrand (Arm)
2026-11-13 13:03   ` Lorenzo Stoakes (ARM)
2026-11-14  2:53 ` sashiko-bot [this message]
2026-11-14  3:10   ` Andrew Morton

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=sashiko-outbox-214060@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=hongfu.li@linux.dev \
    --cc=liam@infradead.org \
    --cc=lihongfu@kylinos.cn \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=rppt@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shuah@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    /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