From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Anshuman <anshumantewari123@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: 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>,
linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests/mm: fix line buffer leak in mremap_test is_range_mapped()
Date: Wed, 26 Aug 2026 09:37:52 +0200 [thread overview]
Message-ID: <cfe22f1a-2ac9-48dc-a2c6-4369e45a852b@kernel.org> (raw)
In-Reply-To: <20260826061300.14038-1-anshumantewari123@gmail.com>
On 8/26/26 08:13, Anshuman wrote:
> is_range_mapped() uses getline() to read /proc/self/maps line by
> line, but never frees the buffer it allocates. Every exit path
> (parse failure, match found, or reaching EOF) returns without
> calling free(line), leaking the buffer on each call. The function
> is called multiple times in this test, so the leak accumulates
> across calls.
>
> Free line before returning.
>
> Signed-off-by: Anshuman <anshumantewari123@gmail.com>
> ---
Looks good, I don't think Fixes is needed (even though called multiple times,
the effective waste should not be relevant on any realistic system).
Thanks!
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
--
Cheers,
David
next prev parent reply other threads:[~2026-08-26 7:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 6:13 [PATCH] selftests/mm: fix line buffer leak in mremap_test is_range_mapped() Anshuman
2026-08-26 7:37 ` David Hildenbrand (Arm) [this message]
2026-08-26 20:42 ` Anshuman Tewari
2026-08-27 0:31 ` SJ Park
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=cfe22f1a-2ac9-48dc-a2c6-4369e45a852b@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=anshumantewari123@gmail.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--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